mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
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:
@@ -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);
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user