diff options
author | Perttu Ahola <celeron55@gmail.com> | 2011-04-11 11:05:40 +0300 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2011-04-11 11:05:40 +0300 |
commit | 3f153c20d3936d18398149082fc453aa55859b1e (patch) | |
tree | 704020458a891f2523f14f2cdff1968368556d7d | |
parent | 67d5f5c1d5c12d7835604e92dd54ee5178e9b893 (diff) | |
download | minetest-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
-rw-r--r-- | src/server.cpp | 9 |
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); |