aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-04-11 11:05:40 +0300
committerPerttu Ahola <celeron55@gmail.com>2011-04-11 11:05:40 +0300
commit3f153c20d3936d18398149082fc453aa55859b1e (patch)
tree704020458a891f2523f14f2cdff1968368556d7d /src
parent67d5f5c1d5c12d7835604e92dd54ee5178e9b893 (diff)
downloadminetest-3f153c20d3936d18398149082fc453aa55859b1e.tar.gz
minetest-3f153c20d3936d18398149082fc453aa55859b1e.tar.bz2
minetest-3f153c20d3936d18398149082fc453aa55859b1e.zip
Fixed error reported by cppcheck:
[./server.cpp:1327]: (error) Possible null pointer dereference: obj - otherwise it is redundant to check if obj is null at line 1332
Diffstat (limited to 'src')
-rw-r--r--src/server.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/server.cpp b/src/server.cpp
index 925b2e0d7..3a1949d98 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -1322,9 +1322,12 @@ void Server::AsyncRunStep()
data_buffer.append(buf, 2);
writeU8((u8*)buf, type);
data_buffer.append(buf, 1);
-
- data_buffer.append(serializeLongString(
- obj->getClientInitializationData()));
+
+ if(obj)
+ data_buffer.append(serializeLongString(
+ obj->getClientInitializationData()));
+ else
+ data_buffer.append(serializeLongString(""));
// Add to known objects
client->m_known_objects.insert(i.getNode()->getKey(), false);