summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 */