Fixed error reported by cppcheck:
authorPerttu Ahola <celeron55@gmail.com>
Mon, 11 Apr 2011 08:05:40 +0000 (11:05 +0300)
committerPerttu Ahola <celeron55@gmail.com>
Mon, 11 Apr 2011 08:05:40 +0000 (11:05 +0300)
[./server.cpp:1327]: (error) Possible null pointer dereference: obj - otherwise it is redundant to check if obj is null at line 1332

src/server.cpp

index 925b2e0d76c430a1086f74159eb54a2587608b3a..3a1949d9815e59057dcf5a3415643cf66b1c22f0 100644 (file)
@@ -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);