summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2016-08-29 14:46:29 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2016-08-29 14:46:29 +0200
commita3cb80f64c3ef6f8e204a90be3b659c7f39e3855 (patch)
treebd8d9a13a3313c3d22ed5e654752f78c6863a5bf
parenttest (diff)
downloadcuberite-a3cb80f64c3ef6f8e204a90be3b659c7f39e3855.tar
cuberite-a3cb80f64c3ef6f8e204a90be3b659c7f39e3855.tar.gz
cuberite-a3cb80f64c3ef6f8e204a90be3b659c7f39e3855.tar.bz2
cuberite-a3cb80f64c3ef6f8e204a90be3b659c7f39e3855.tar.lz
cuberite-a3cb80f64c3ef6f8e204a90be3b659c7f39e3855.tar.xz
cuberite-a3cb80f64c3ef6f8e204a90be3b659c7f39e3855.tar.zst
cuberite-a3cb80f64c3ef6f8e204a90be3b659c7f39e3855.zip
Diffstat (limited to '')
-rw-r--r--src/ClientHandle.cpp5
-rw-r--r--src/Server.h3
2 files changed, 7 insertions, 1 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 143d5df03..01d85fee8 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -104,7 +104,10 @@ cClientHandle::~cClientHandle()
{
ASSERT(m_State == eState::csDestroyed); // Has Destroy() been called?
- if (m_Player != nullptr)
+ if (
+ !cRoot::Get()->GetServer()->IsShuttingDown() && // If server is shutting down, m_Player is considered invalid. It will be cleaned up by cWorld
+ (m_Player != nullptr)
+ )
{
cWorld * World = m_Player->GetWorld();
diff --git a/src/Server.h b/src/Server.h
index 9fa9ee839..d36188baf 100644
--- a/src/Server.h
+++ b/src/Server.h
@@ -94,6 +94,9 @@ public:
void Shutdown(void);
+ /** Returns whether cServer::Shutdown has been called */
+ bool IsShuttingDown(void) { return m_bRestarting; }
+
void KickUser(int a_ClientID, const AString & a_Reason);
/** Authenticates the specified user, called by cAuthenticator */