From a3cb80f64c3ef6f8e204a90be3b659c7f39e3855 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Mon, 29 Aug 2016 13:46:29 +0100 Subject: test --- src/ClientHandle.cpp | 5 ++++- src/Server.h | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) 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 */ -- cgit v1.2.3