summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-12-07 16:14:27 +0100
committerMattes D <github@xoft.cz>2014-12-07 16:14:27 +0100
commite08331a24b1c6bb2994c8dabfe5911e72c14f974 (patch)
treec513e421391218cdfa2ac0fe9f653ad688a2db5c /src
parentFixed c++11 branch issues. (diff)
downloadcuberite-e08331a24b1c6bb2994c8dabfe5911e72c14f974.tar
cuberite-e08331a24b1c6bb2994c8dabfe5911e72c14f974.tar.gz
cuberite-e08331a24b1c6bb2994c8dabfe5911e72c14f974.tar.bz2
cuberite-e08331a24b1c6bb2994c8dabfe5911e72c14f974.tar.lz
cuberite-e08331a24b1c6bb2994c8dabfe5911e72c14f974.tar.xz
cuberite-e08331a24b1c6bb2994c8dabfe5911e72c14f974.tar.zst
cuberite-e08331a24b1c6bb2994c8dabfe5911e72c14f974.zip
Diffstat (limited to 'src')
-rw-r--r--src/World.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/World.cpp b/src/World.cpp
index 91e1199ee..e73dcb915 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -346,6 +346,10 @@ cWorld::~cWorld()
Serializer.Save();
m_MapManager.SaveMapData();
+
+ // Explicitly destroy the chunkmap, so that it's guaranteed to be destroyed before the other internals
+ // This fixes crashes on stopping the server, because chunk destructor deletes entities and those access the world.
+ m_ChunkMap.reset();
}
@@ -3122,6 +3126,11 @@ bool cWorld::HasEntity(int a_UniqueID)
}
// Check if the entity is in the chunkmap:
+ if (m_ChunkMap.get() == nullptr)
+ {
+ // Chunkmap has already been destroyed, there are no entities anymore.
+ return false;
+ }
return m_ChunkMap->HasEntity(a_UniqueID);
}