Fix crash if server lobby is NULL

This commit is contained in:
Benau 2018-09-06 08:41:13 +08:00
parent a5c9bbd3ef
commit 3cdc1b6ddd

View File

@ -924,8 +924,10 @@ void ServerLobby::checkIncomingConnectionRequests()
const XMLNode * users_xml = result->getNode("users"); const XMLNode * users_xml = result->getNode("users");
std::map<uint32_t, KeyData> keys; std::map<uint32_t, KeyData> keys;
auto sl = m_server_lobby.lock(); auto sl = m_server_lobby.lock();
if (!sl || (sl->m_state.load() != WAITING_FOR_START_GAME && if (!sl)
!sl->allowJoinedPlayersWaiting())) return;
if (sl->m_state.load() != WAITING_FOR_START_GAME &&
!sl->allowJoinedPlayersWaiting())
{ {
sl->replaceKeys(keys); sl->replaceKeys(keys);
return; return;