diff options
author | celeron55 <celeron55@gmail.com> | 2011-09-24 00:55:05 -0700 |
---|---|---|
committer | celeron55 <celeron55@gmail.com> | 2011-09-24 00:55:05 -0700 |
commit | 63eca0feb2a08aa15f8be1164c4815a44246a2e6 (patch) | |
tree | 06dbb4a78fbe7bf0f631c1aa56527c9c18d0e3ee | |
parent | 789c88509c1eab8407d3451d55eb31f65150e54a (diff) | |
parent | ae561d705fc6f0d762203016c24c26a3a3a6b986 (diff) | |
download | minetest-63eca0feb2a08aa15f8be1164c4815a44246a2e6.tar.gz minetest-63eca0feb2a08aa15f8be1164c4815a44246a2e6.tar.bz2 minetest-63eca0feb2a08aa15f8be1164c4815a44246a2e6.zip |
Merge pull request #10 from joshbeck/master
Fixed null pointer dereference errors found by cppcheck
-rw-r--r-- | src/environment.cpp | 7 | ||||
-rw-r--r-- | src/server.cpp | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/environment.cpp b/src/environment.cpp index 8103b7110..07c535b70 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -1345,8 +1345,6 @@ void ServerEnvironment::deactivateFarObjects(bool force_delete) i.atEnd()==false; i++) { ServerActiveObject* obj = i.getNode()->getValue(); - u16 id = i.getNode()->getKey(); - v3f objectpos = obj->getBasePosition(); // This shouldn't happen but check it if(obj == NULL) @@ -1357,9 +1355,12 @@ void ServerEnvironment::deactivateFarObjects(bool force_delete) continue; } + u16 id = i.getNode()->getKey(); + v3f objectpos = obj->getBasePosition(); + // The block in which the object resides in v3s16 blockpos_o = getNodeBlockPos(floatToInt(objectpos, BS)); - + // If block is active, don't remove if(m_active_blocks.contains(blockpos_o)) continue; diff --git a/src/server.cpp b/src/server.cpp index a04417074..ba0efe75f 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -4109,7 +4109,7 @@ void Server::UpdateCrafting(u16 peer_id) InventoryList *clist = player->inventory.getList("craft"); InventoryList *rlist = player->inventory.getList("craftresult"); - if(rlist->getUsedSlots() == 0) + if(rlist && rlist->getUsedSlots() == 0) player->craftresult_is_preview = true; if(rlist && player->craftresult_is_preview) |