From 3f153c20d3936d18398149082fc453aa55859b1e Mon Sep 17 00:00:00 2001
From: Perttu Ahola <celeron55@gmail.com>
Date: Mon, 11 Apr 2011 11:05:40 +0300
Subject: [PATCH] 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

---
 src/server.cpp | 9 ++++++---
 1 file 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);
-- 
GitLab