summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2016-08-20 17:19:54 +0200
committerGitHub <noreply@github.com>2016-08-20 17:19:54 +0200
commit7b3a8a535a12bb13cb59bf4ab3f6761799088b26 (patch)
treed72b0085a3a91ad2ab5bb552722d3f1697d15bc2
parentMerge pull request #3332 from cuberite/FixRounding (diff)
downloadcuberite-7b3a8a535a12bb13cb59bf4ab3f6761799088b26.tar
cuberite-7b3a8a535a12bb13cb59bf4ab3f6761799088b26.tar.gz
cuberite-7b3a8a535a12bb13cb59bf4ab3f6761799088b26.tar.bz2
cuberite-7b3a8a535a12bb13cb59bf4ab3f6761799088b26.tar.lz
cuberite-7b3a8a535a12bb13cb59bf4ab3f6761799088b26.tar.xz
cuberite-7b3a8a535a12bb13cb59bf4ab3f6761799088b26.tar.zst
cuberite-7b3a8a535a12bb13cb59bf4ab3f6761799088b26.zip
-rw-r--r--src/Entities/Minecart.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/Entities/Minecart.cpp b/src/Entities/Minecart.cpp
index 8eda447cf..130ea955f 100644
--- a/src/Entities/Minecart.cpp
+++ b/src/Entities/Minecart.cpp
@@ -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);
+ });
}