diff --git a/src/network/protocol.cpp b/src/network/protocol.cpp index 0f9a7a068..607e9df68 100644 --- a/src/network/protocol.cpp +++ b/src/network/protocol.cpp @@ -79,7 +79,8 @@ bool Protocol::checkDataSize(Event* event, unsigned int minimum_size) */ void Protocol::requestStart() { - ProtocolManager::lock()->requestStart(shared_from_this()); + if (auto pm = ProtocolManager::lock()) + pm->requestStart(shared_from_this()); } // requestStart // ---------------------------------------------------------------------------- @@ -87,7 +88,8 @@ void Protocol::requestStart() */ void Protocol::requestPause() { - ProtocolManager::lock()->requestPause(shared_from_this()); + if (auto pm = ProtocolManager::lock()) + pm->requestPause(shared_from_this()); } // requestPause // ---------------------------------------------------------------------------- @@ -95,7 +97,8 @@ void Protocol::requestPause() */ void Protocol::requestUnpause() { - ProtocolManager::lock()->requestUnpause(shared_from_this()); + if (auto pm = ProtocolManager::lock()) + pm->requestUnpause(shared_from_this()); } // requestUnpause // ---------------------------------------------------------------------------- @@ -103,7 +106,8 @@ void Protocol::requestUnpause() */ void Protocol::requestTerminate() { - ProtocolManager::lock()->requestTerminate(shared_from_this()); + if (auto pm = ProtocolManager::lock()) + pm->requestTerminate(shared_from_this()); } // requestTerminate // ---------------------------------------------------------------------------- diff --git a/src/network/protocols/client_lobby.cpp b/src/network/protocols/client_lobby.cpp index d01e987d2..6086d6e05 100644 --- a/src/network/protocols/client_lobby.cpp +++ b/src/network/protocols/client_lobby.cpp @@ -369,7 +369,7 @@ void ClientLobby::update(float dt) break; case DONE: m_state = EXITING; - ProtocolManager::lock()->requestTerminate(shared_from_this()); + requestTerminate(); break; case EXITING: break;