Core/Aura: Replace assert with logged error for invalid AuraRemoveMode

Fix AuraScript::Remove() triggering an assert with default parameter and log an error when Aura is removed with invalid mode AURA_REMOVE_NONE instead of triggering an assert deep down in the call tree.
Fix https://github.com/TrinityCore/TrinityCore/issues/714 , triggered by spell 50240 "Evasive Maneuvers" script
This commit is contained in:
jackpoz
2015-01-07 22:48:34 +01:00
parent 253dc0f99e
commit 9ea93eae33
3 changed files with 9 additions and 3 deletions

View File

@@ -3587,6 +3587,12 @@ void Unit::RemoveOwnedAura(Aura* aura, AuraRemoveMode removeMode)
ASSERT(aura->GetOwner() == this);
if (removeMode == AURA_REMOVE_NONE)
{
TC_LOG_ERROR("spells", "Unit::RemoveOwnedAura() called with unallowed removeMode AURA_REMOVE_NONE, spellId %u", aura->GetId());
return;
}
uint32 spellId = aura->GetId();
AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);

View File

@@ -1001,9 +1001,9 @@ DynamicObject* AuraScript::GetDynobjOwner() const
return m_aura->GetDynobjOwner();
}
void AuraScript::Remove(uint32 removeMode)
void AuraScript::Remove(AuraRemoveMode removeMode)
{
m_aura->Remove((AuraRemoveMode)removeMode);
m_aura->Remove(removeMode);
}
Aura* AuraScript::GetAura() const

View File

@@ -813,7 +813,7 @@ class AuraScript : public _SpellScript
DynamicObject* GetDynobjOwner() const;
// removes aura with remove mode (see AuraRemoveMode enum)
void Remove(uint32 removeMode = 0);
void Remove(AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
// returns aura object of script
Aura* GetAura() const;