summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Root.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/Root.cpp b/src/Root.cpp
index a5567dc9b..80366e5c1 100644
--- a/src/Root.cpp
+++ b/src/Root.cpp
@@ -343,11 +343,14 @@ void cRoot::StopServer()
}
public:
cPlayerCallback(AString a_ShutdownMessage) : m_ShutdownMessage(a_ShutdownMessage) {}
- } PlayerCallback((m_Server->GetShutdownMessage()));
+ };
- cRoot::Get()->ForEachPlayer(PlayerCallback);
- // What's a better way to do this?
- std::this_thread::sleep_for(std::chrono::seconds(1));
+ if (m_Server->GetNumPlayers())
+ {
+ cPlayerCallback PlayerCallback((m_Server->GetShutdownMessage()));
+ cRoot::Get()->ForEachPlayer(PlayerCallback);
+ std::this_thread::sleep_for(std::chrono::seconds(1));
+ }
m_TerminateEventRaised = true;
m_StopEvent.Set();
m_InputThreadRunFlag.clear();