Fixing nasty crash when a player left a game which was not running.

This commit is contained in:
lotodore
2011-11-15 19:56:23 +00:00
parent 56e18e1044
commit f968aae6c0
+2
View File
@@ -674,10 +674,12 @@ AbstractClientStateReceiving::HandlePacket(boost::shared_ptr<ClientThread> clien
// A player left the game.
GamePlayerLeft_t *netLeft = &netGamePlayer->gamePlayerNotification.choice.gamePlayerLeft;
if (client->GetGame()) {
boost::shared_ptr<PlayerInterface> tmpPlayer = client->GetGame()->getPlayerByUniqueId(netLeft->playerId);
if (tmpPlayer) {
tmpPlayer->setIsKicked(netLeft->gamePlayerLeftReason == gamePlayerLeftReason_leftKicked);
}
}
// Signal to GUI and remove from data list.
client->RemovePlayerData(netLeft->playerId, netLeft->gamePlayerLeftReason);
} else if (netGamePlayer->gamePlayerNotification.present == gamePlayerNotification_PR_gameAdminChanged) {