1
0

Fixed minecraft with chest destruction crash (#3335)

This commit is contained in:
LogicParrot 2016-08-20 18:19:54 +03:00 committed by GitHub
parent c61746a392
commit 7b3a8a535a

View File

@ -1206,10 +1206,19 @@ void cMinecartWithChest::OpenNewWindow()
void cMinecartWithChest::Destroyed()
{
GetWindow()->OwnerDestroyed();
if (GetWindow() != nullptr)
{
GetWindow()->OwnerDestroyed();
}
cItems Pickups;
m_Contents.CopyToItems(Pickups);
GetWorld()->SpawnItemPickups(Pickups, GetPosX(), GetPosY() + 1, GetPosZ(), 4);
// This makes the command not execute if the world is in the midst of destruction :)
GetWorld()->ScheduleTask(1, [this, &Pickups](cWorld & World)
{
World.SpawnItemPickups(Pickups, GetPosX(), GetPosY() + 1, GetPosZ(), 4);
});
}