Skip to content

Commit

Permalink
fix: added player nullpointer check (function updateCreatureType) (op…
Browse files Browse the repository at this point in the history
…entibiabr#791)

Added null pointer check in Game::updateCreatureType function to ensure that there is no unexpected behaviour when accessing the object, and it does not exist.
  • Loading branch information
dudantas authored Jan 18, 2023
1 parent d4ec6cc commit bdd4b09
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/game/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6746,6 +6746,10 @@ void Game::updateCreatureType(Creature* creature)
if (creatureType == CREATURETYPE_SUMMON_OTHERS) {
for (Creature* spectator : spectators) {
Player* player = spectator->getPlayer();
if (!player) {
continue;
}

if (masterPlayer == player) {
player->sendCreatureType(creature, CREATURETYPE_SUMMON_PLAYER);
} else {
Expand Down

0 comments on commit bdd4b09

Please sign in to comment.