mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-30 10:33:54 -07:00
[ServerGame] null check participant in getPlayer (#6493)
This commit is contained in:
parent
2d5e8deb75
commit
731c487ccb
1 changed files with 1 additions and 1 deletions
|
|
@ -232,7 +232,7 @@ QMap<int, Server_AbstractPlayer *> Server_Game::getPlayers() const // copies poi
|
||||||
Server_AbstractPlayer *Server_Game::getPlayer(int id) const
|
Server_AbstractPlayer *Server_Game::getPlayer(int id) const
|
||||||
{
|
{
|
||||||
auto *participant = participants.value(id);
|
auto *participant = participants.value(id);
|
||||||
if (!participant->isSpectator()) {
|
if (participant && !participant->isSpectator()) {
|
||||||
return static_cast<Server_AbstractPlayer *>(participant);
|
return static_cast<Server_AbstractPlayer *>(participant);
|
||||||
} else {
|
} else {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue