Core/Auras: Prevent possible crash on SPELL_AURA_DAMAGE_SHIELD aura handler.

This commit is contained in:
QAston
2011-02-04 03:14:01 +01:00
parent f862db8b92
commit e9bae2d0a0
+4 -2
View File
@@ -1390,8 +1390,10 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
// Do effect if any damage done to target
if (damageInfo->damage)
{
AuraEffectList const& vDamageShields = pVictim->GetAuraEffectsByType(SPELL_AURA_DAMAGE_SHIELD);
for (AuraEffectList::const_iterator dmgShieldItr = vDamageShields.begin(); dmgShieldItr != vDamageShields.end(); ++dmgShieldItr)
// We're going to call functions which can modify content of the list during iteration over it's elements
// Let's copy the list so we can prevent iterator invalidation
AuraEffectList vDamageShieldsCopy(pVictim->GetAuraEffectsByType(SPELL_AURA_DAMAGE_SHIELD));
for (AuraEffectList::const_iterator dmgShieldItr = vDamageShieldsCopy.begin(); dmgShieldItr != vDamageShieldsCopy.end(); ++dmgShieldItr)
{
SpellEntry const *i_spellProto = (*dmgShieldItr)->GetSpellProto();
// Damage shield can be resisted...