From 32615d05cfd9a6a37c7e690fa626ee75011df2f8 Mon Sep 17 00:00:00 2001 From: Koncord Date: Tue, 10 Jan 2017 18:31:51 +0800 Subject: [PATCH] Prevent allocate memory if player doesn't exists --- apps/openmw-mp/Player.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/openmw-mp/Player.cpp b/apps/openmw-mp/Player.cpp index ec7d15ae8..d581813a3 100644 --- a/apps/openmw-mp/Player.cpp +++ b/apps/openmw-mp/Player.cpp @@ -52,6 +52,8 @@ void Players::newPlayer(RakNet::RakNetGUID guid) Player *Players::getPlayer(RakNet::RakNetGUID guid) { + if(players.count(guid) == 0) + return nullptr; return players[guid]; }