Scripts/VioletHold: Fix crash

Fix crash in Violet Hold happening when crystals were activated without killing trash mobs.
Crash added in cba6515acb and f4531c5a58 .
Closes #14629

(cherry picked from commit 09aed25659)
This commit is contained in:
jackpoz
2015-05-03 11:57:04 +02:00
committed by DDuarte
parent 0f6788c3df
commit 133d6cd85f

View File

@@ -794,9 +794,11 @@ public:
trigger->CastSpell(trigger, spellInfoLightning, true, 0, 0, trigger->GetGUID());
// Kill all mobs registered with SetGuidData(ADD_TRASH_MOB)
for (GuidSet::const_iterator itr = trashMobs.begin(); itr != trashMobs.end(); ++itr)
for (GuidSet::const_iterator itr = trashMobs.begin(); itr != trashMobs.end();)
{
Creature* creature = instance->GetCreature(*itr);
// Increment the iterator before killing the creature because the kill will remove itr from trashMobs
++itr;
if (creature && creature->IsAlive())
trigger->Kill(creature);
}