Scripts/SholazarBasin: Fix a possible nullptr dereference issue found by coverity (#26648)

(cherry picked from commit 3bcda5acf4564b662db4dfde0af7279f99a93b79)
This commit is contained in:
Peter Keresztes Schmidt
2022-03-11 14:33:57 +01:00
committed by Shauren
parent 161bba72f0
commit 28a7ca9183
@@ -130,7 +130,10 @@ class spell_q12688_detonate_1 : public SpellScript
target->GetMap()->SpawnGroupSpawn(SPAWN_GROUP_FLAMES, false, false, &flames);
target->GetMap()->SetSpawnGroupInactive(SPAWN_GROUP_FLAMES);
for (WorldObject* flame : flames)
dynamic_cast<GameObject*>(flame)->DespawnOrUnsummon(20s);
{
if (GameObject* flame_go = flame->ToGameObject())
flame_go->DespawnOrUnsummon(20s);
}
}
}
@@ -168,7 +171,10 @@ class spell_q12688_detonate_2 : public SpellScript
target->GetMap()->SpawnGroupSpawn(SPAWN_GROUP_FLAMES, false, false, &flames);
target->GetMap()->SetSpawnGroupInactive(SPAWN_GROUP_FLAMES);
for (WorldObject* flame : flames)
dynamic_cast<GameObject*>(flame)->DespawnOrUnsummon(20s);
{
if (GameObject* flame_go = flame->ToGameObject())
flame_go->DespawnOrUnsummon(20s);
}
}
}