Skip to content

Commit 09aed25

Browse files
committed
Scripts/VioletHold: Fix crash
Fix crash in Violet Hold happening when crystals were activated without killing trash mobs. Crash added in cba6515 and f4531c5 . Closes #14629
1 parent bb86eed commit 09aed25

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -794,9 +794,11 @@ class instance_violet_hold : public InstanceMapScript
794794
trigger->CastSpell(trigger, spellInfoLightning, true, 0, 0, trigger->GetGUID());
795795

796796
// Kill all mobs registered with SetGuidData(ADD_TRASH_MOB)
797-
for (GuidSet::const_iterator itr = trashMobs.begin(); itr != trashMobs.end(); ++itr)
797+
for (GuidSet::const_iterator itr = trashMobs.begin(); itr != trashMobs.end();)
798798
{
799799
Creature* creature = instance->GetCreature(*itr);
800+
// Increment the iterator before killing the creature because the kill will remove itr from trashMobs
801+
++itr;
800802
if (creature && creature->IsAlive())
801803
trigger->Kill(creature);
802804
}

0 commit comments

Comments
 (0)