From 5623a045f598a068a7bae77cc3acad62f6160452 Mon Sep 17 00:00:00 2001 From: Tycho Date: Sun, 10 Aug 2014 22:06:56 +0100 Subject: Fixed potential null dereference Fixes CID 70466 --- src/BlockEntities/HopperEntity.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/BlockEntities/HopperEntity.cpp') diff --git a/src/BlockEntities/HopperEntity.cpp b/src/BlockEntities/HopperEntity.cpp index 48d3b8dcc..88e7b8e1b 100644 --- a/src/BlockEntities/HopperEntity.cpp +++ b/src/BlockEntities/HopperEntity.cpp @@ -549,13 +549,13 @@ bool cHopperEntity::MoveItemsFromSlot(cBlockEntityWithItems & a_Entity, int a_Sl bool cHopperEntity::MoveItemsToChest(cChunk & a_Chunk, int a_BlockX, int a_BlockY, int a_BlockZ) { // Try the chest directly connected to the hopper: - cChestEntity * Chest = (cChestEntity *)a_Chunk.GetBlockEntity(a_BlockX, a_BlockY, a_BlockZ); - if (Chest == NULL) + cChestEntity * ConnectedChest = (cChestEntity *)a_Chunk.GetBlockEntity(a_BlockX, a_BlockY, a_BlockZ); + if (ConnectedChest == NULL) { LOGWARNING("%s: A chest entity was not found where expected, at {%d, %d, %d}", __FUNCTION__, a_BlockX, a_BlockY, a_BlockZ); return false; } - if (MoveItemsToGrid(*Chest)) + if (MoveItemsToGrid(*ConnectedChest)) { // Chest block directly connected was not full return true; @@ -586,13 +586,13 @@ bool cHopperEntity::MoveItemsToChest(cChunk & a_Chunk, int a_BlockX, int a_Block } BLOCKTYPE Block = Neighbor->GetBlock(x, a_BlockY, z); - if (Block != Chest->GetBlockType()) + if (Block != ConnectedChest->GetBlockType()) { // Not the same kind of chest continue; } - Chest = (cChestEntity *)Neighbor->GetBlockEntity(a_BlockX + Coords[i].x, a_BlockY, a_BlockZ + Coords[i].z); + cChestEntity * Chest = (cChestEntity *)Neighbor->GetBlockEntity(a_BlockX + Coords[i].x, a_BlockY, a_BlockZ + Coords[i].z); if (Chest == NULL) { LOGWARNING("%s: A chest entity was not found where expected, at {%d, %d, %d} (%d, %d)", __FUNCTION__, a_BlockX + Coords[i].x, a_BlockY, a_BlockZ + Coords[i].z, x, z); -- cgit v1.2.3 From a3f940f47c8981146feed66225c1dd8066bac0e2 Mon Sep 17 00:00:00 2001 From: Tycho Date: Fri, 26 Sep 2014 18:13:19 +0100 Subject: Removed more unessicary includes --- src/BlockEntities/HopperEntity.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/BlockEntities/HopperEntity.cpp') diff --git a/src/BlockEntities/HopperEntity.cpp b/src/BlockEntities/HopperEntity.cpp index 88e7b8e1b..444378c92 100644 --- a/src/BlockEntities/HopperEntity.cpp +++ b/src/BlockEntities/HopperEntity.cpp @@ -10,10 +10,7 @@ #include "../Entities/Pickup.h" #include "../Bindings/PluginManager.h" #include "ChestEntity.h" -#include "DropSpenserEntity.h" #include "FurnaceEntity.h" -#include "../BoundingBox.h" -#include "json/json.h" -- cgit v1.2.3 From 9e4a5f824ae88e3a19de6a14db91b43c1759e29e Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Tue, 30 Sep 2014 22:20:21 +0100 Subject: Removed WSSCompact --- src/BlockEntities/HopperEntity.cpp | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'src/BlockEntities/HopperEntity.cpp') diff --git a/src/BlockEntities/HopperEntity.cpp b/src/BlockEntities/HopperEntity.cpp index 444378c92..103f516fc 100644 --- a/src/BlockEntities/HopperEntity.cpp +++ b/src/BlockEntities/HopperEntity.cpp @@ -70,17 +70,6 @@ bool cHopperEntity::Tick(float a_Dt, cChunk & a_Chunk) -void cHopperEntity::SaveToJson(Json::Value & a_Value) -{ - UNUSED(a_Value); - // TODO - LOGWARNING("%s: Not implemented yet", __FUNCTION__); -} - - - - - void cHopperEntity::SendTo(cClientHandle & a_Client) { // The hopper entity doesn't need anything sent to the client when it's created / gets in the viewdistance -- cgit v1.2.3