From: Perttu Ahola Date: Mon, 11 Apr 2011 08:05:40 +0000 (+0300) Subject: Fixed error reported by cppcheck: X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=3f153c20d3936d18398149082fc453aa55859b1e;p=zefram%2Fminetest%2Fminetest_engine.git 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 --- diff --git a/src/server.cpp b/src/server.cpp index 925b2e0d..3a1949d9 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);