Fixing nasty crash when a player left a game which was not running.
This commit is contained in:
1 parent
56e18e1044
commit
f968aae6c0
1 file changed
+5
-3
@@ -674,9 +674,11 @@ AbstractClientStateReceiving::HandlePacket(boost::shared_ptr<ClientThread> clien
|
|||||||
// A player left the game.
|
// A player left the game.
|
||||||
GamePlayerLeft_t *netLeft = &netGamePlayer->gamePlayerNotification.choice.gamePlayerLeft;
|
GamePlayerLeft_t *netLeft = &netGamePlayer->gamePlayerNotification.choice.gamePlayerLeft;
|
||||||
|
|
||||||
boost::shared_ptr<PlayerInterface> tmpPlayer = client->GetGame()->getPlayerByUniqueId(netLeft->playerId);
|
if (client->GetGame()) {
|
||||||
if (tmpPlayer) {
|
boost::shared_ptr<PlayerInterface> tmpPlayer = client->GetGame()->getPlayerByUniqueId(netLeft->playerId);
|
||||||
tmpPlayer->setIsKicked(netLeft->gamePlayerLeftReason == gamePlayerLeftReason_leftKicked);
|
if (tmpPlayer) {
|
||||||
|
tmpPlayer->setIsKicked(netLeft->gamePlayerLeftReason == gamePlayerLeftReason_leftKicked);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Signal to GUI and remove from data list.
|
// Signal to GUI and remove from data list.
|
||||||
client->RemovePlayerData(netLeft->playerId, netLeft->gamePlayerLeftReason);
|
client->RemovePlayerData(netLeft->playerId, netLeft->gamePlayerLeftReason);
|
||||||
|
|||||||
Reference in new issue
Block a user