Check peer first to avoid crash

This commit is contained in:
Benau 2019-10-16 10:43:36 +08:00
parent 11897da80c
commit 3b75740163

View File

@ -4561,10 +4561,10 @@ bool ServerLobby::checkPeersReady(bool ignore_ai_peer) const
for (auto p : m_peers_ready) for (auto p : m_peers_ready)
{ {
auto peer = p.first.lock(); auto peer = p.first.lock();
if (ignore_ai_peer && peer->isAIPeer())
continue;
if (!peer) if (!peer)
continue; continue;
if (ignore_ai_peer && peer->isAIPeer())
continue;
all_ready = all_ready && p.second; all_ready = all_ready && p.second;
if (!all_ready) if (!all_ready)
return false; return false;