1
0

Merge pull request #3471 from marvinkopf/fix-3417

Fix comparator segfaults
This commit is contained in:
Julian Laubstein 2016-12-06 23:48:32 +01:00 committed by GitHub
commit e8ea1f8cc3

View File

@ -54,7 +54,14 @@ public:
virtual bool Item(cBlockEntity * a_BlockEntity) override
{
auto & Contents = static_cast<cBlockEntityWithItems *>(a_BlockEntity)->GetContents();
// Skip BlockEntities that don't have slots
auto BlockEntityWithItems = dynamic_cast<cBlockEntityWithItems *>(a_BlockEntity);
if (BlockEntityWithItems == nullptr)
{
return false;
}
auto & Contents = BlockEntityWithItems->GetContents();
float Fullness = 0; // Is a floating-point type to allow later calculation to produce a non-truncated value
for (int Slot = 0; Slot != Contents.GetNumSlots(); ++Slot)