client: fixed crash that happened when trying to send a game command in the replay viewer
This commit is contained in:
parent
e7b58c4d8e
commit
b1f37a18c9
1 changed files with 9 additions and 2 deletions
|
@ -813,7 +813,9 @@ AbstractClient *TabGame::getClientForPlayer(int playerId) const
|
|||
playerId = getActiveLocalPlayer()->getId();
|
||||
|
||||
return clients.at(playerId);
|
||||
} else
|
||||
} else if (clients.isEmpty())
|
||||
return 0;
|
||||
else
|
||||
return clients.first();
|
||||
}
|
||||
|
||||
|
@ -830,12 +832,17 @@ int TabGame::getPlayerIdByName(const QString &playerName) const
|
|||
|
||||
void TabGame::sendGameCommand(PendingCommand *pend, int playerId)
|
||||
{
|
||||
getClientForPlayer(playerId)->sendCommand(pend);
|
||||
AbstractClient *client = getClientForPlayer(playerId);
|
||||
if (!client)
|
||||
return;
|
||||
client->sendCommand(pend);
|
||||
}
|
||||
|
||||
void TabGame::sendGameCommand(const google::protobuf::Message &command, int playerId)
|
||||
{
|
||||
AbstractClient *client = getClientForPlayer(playerId);
|
||||
if (!client)
|
||||
return;
|
||||
client->sendCommand(prepareGameCommand(command));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue