From 3cf8ae345c918faef9b01acfa78371d539e24ea2 Mon Sep 17 00:00:00 2001 From: megamage Date: Wed, 26 Aug 2009 17:44:00 -0500 Subject: *Fix a crash caused by area aura. Thanks to nanouniko --HG-- branch : trunk --- src/game/Unit.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 67a7d9a5d6f..c1981a05df0 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -14554,6 +14554,8 @@ void Unit::SetAuraStack(uint32 spellId, Unit *target, uint32 stack) aur->SetStackAmount(stack); } +// This function is only used for area aura and creature addon +// it should be removed in the future Aura * Unit::AddAuraEffect(const SpellEntry * spellInfo, uint8 effIndex, WorldObject *source, Unit* caster, int32 * basePoints) { // can't do that for passive auras - they stack from same caster so there is no way to get exact aura which should get effect @@ -14562,8 +14564,14 @@ Aura * Unit::AddAuraEffect(const SpellEntry * spellInfo, uint8 effIndex, WorldOb sLog.outDebug("AddAuraEffect: spell id: %u, effect index: %u", spellInfo->Id, (uint32)effIndex); Aura *aur = GetAura(spellInfo->Id, caster->GetGUID()); + // without this it may crash when shaman refresh totem? source is NULL + if(aur && aur->GetSourceGUID() != source->GetGUID()) + { + RemoveAura(aur); + aur = NULL; + } - if (aur) + if(aur) { if(AuraEffect *aurEffect = CreateAuraEffect(aur, effIndex, basePoints)) if(!aur->SetPartAura(aurEffect, effIndex)) -- cgit v1.2.3