From 46c7446bd4ef606b1091c1582df50e027fab28b6 Mon Sep 17 00:00:00 2001 From: jackpoz Date: Sat, 2 Feb 2019 21:00:28 +0100 Subject: Core/Spells: Fix assert triggered Fix assert triggered when a spell would trigger another spell in OnEffectHitTarget that would kill the aura owner, then processing the main spell effects. The triggered spell can kill the aura owner, changing its death state to CORPSE and removing auras created. Fix #21856 Ref 518e6299ca08a362bc3709daaaa5e5d5633d1bf1 --- src/server/game/Entities/Unit/Unit.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 19751409268..a7868af74b7 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -3291,9 +3291,14 @@ AuraApplication* Unit::_CreateAuraApplication(Aura* aura, uint8 effMask) { // can't apply aura on unit which is going to be deleted - to not create a memory leak ASSERT(!m_cleanupDone); - // aura musn't be removed (but it could have been removed by OnEffectHitTarget script handler - // casting a spell that killed the target and set deathState to CORPSE) - ASSERT(!aura->IsRemoved() || !IsAlive()); + + // just return if the aura has been already removed + // this can happen if OnEffectHitTarget() script hook killed the unit or the aura owner (which can be different) + if (aura->IsRemoved()) + { + TC_LOG_ERROR("spells", "Unit::_CreateAuraApplication() called with a removed aura. Check if OnEffectHitTarget() is triggering any spell with apply aura effect (that's not allowed!)\nUnit: %s\nAura: %s", GetDebugInfo().c_str(), aura->GetDebugInfo().c_str()); + return nullptr; + } // aura mustn't be already applied on target ASSERT (!aura->IsAppliedOnTarget(GetGUID()) && "Unit::_CreateAuraApplication: aura musn't be applied on target"); -- cgit v1.2.3