aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2019-01-19 17:41:03 +0100
committerjackpoz <giacomopoz@gmail.com>2019-01-19 17:41:03 +0100
commit518e6299ca08a362bc3709daaaa5e5d5633d1bf1 (patch)
treeb22560f79b5865154ff414898964d14a4fd9dd8f
parentdc628b23e26232a277dbcac2498d18b3f1e3b4e2 (diff)
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
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index b479eb7d25d..19751409268 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -3291,8 +3291,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");