Try to fix some aura update related crashes.

--HG--
branch : trunk
This commit is contained in:
QAston
2009-04-12 17:53:05 +02:00
parent fcbdb10122
commit cb5b56785f
+11 -5
View File
@@ -764,16 +764,19 @@ void AreaAuraEffect::Update(uint32 diff)
} }
else // aura at non-caster else // aura at non-caster
{ {
Unit * tmp_target = m_target; // WARNING: the aura may get deleted during the update
// DO NOT access its members after update!
AuraEffect::Update(diff);
// Speedup - no need to do more checks
if (GetParentAura()->IsRemoved())
return;
Unit* caster = GetCaster(); Unit* caster = GetCaster();
uint32 tmp_spellId = GetId(); uint32 tmp_spellId = GetId();
uint32 tmp_effIndex = GetEffIndex(); uint32 tmp_effIndex = GetEffIndex();
uint64 tmp_guid = GetCasterGUID(); uint64 tmp_guid = GetCasterGUID();
// WARNING: the aura may get deleted during the update
// DO NOT access its members after update!
AuraEffect::Update(diff);
// remove aura if out-of-range from caster (after teleport for example) // remove aura if out-of-range from caster (after teleport for example)
// or caster is isolated or caster no longer has the aura // or caster is isolated or caster no longer has the aura
// or caster is (no longer) friendly // or caster is (no longer) friendly
@@ -841,7 +844,10 @@ void PersistentAreaAuraEffect::Update(uint32 diff)
remove = true; remove = true;
if(remove) if(remove)
{
m_target->RemoveAura(GetParentAura()); m_target->RemoveAura(GetParentAura());
return;
}
AuraEffect::Update(diff); AuraEffect::Update(diff);
} }