From 1180c43bacffd6cbf60fd8a82a0a748c13c7e971 Mon Sep 17 00:00:00 2001 From: jackpoz Date: Sat, 19 Jan 2019 17:41:03 +0100 Subject: [PATCH] Core/Spells: Fix assert triggered Fix assert triggered when a spell would trigger another spell in OnEffectHitTarget that would kill the target, then processing the main spell effects. The triggered spell can kill the target, changing its death state to CORPSE and removing auras created. Fix #22306 --- src/server/game/Entities/Unit/Unit.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 4fd45da3c7..7be081721c 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -3140,8 +3140,9 @@ 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 - ASSERT(!aura->IsRemoved()); + // 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()); // aura mustn't be already applied on target ASSERT (!aura->IsAppliedOnTarget(GetGUID()) && "Unit::_CreateAuraApplication: aura musn't be applied on target");