Core/Spells: Fix assert triggered

Port From (https://github.com/TrinityCore/TrinityCore/commit/e475cac63134be27d0902cb0d3efd869217bb464)
This commit is contained in:
hondacrx
2021-11-23 22:28:11 -05:00
parent cb74ab8075
commit e46fde9cdd
+7 -3
View File
@@ -1475,9 +1475,13 @@ namespace Game.Entities
{
// can't apply aura on unit which is going to be deleted - to not create a memory leak
Cypher.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)
Cypher.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())
{
Log.outError(LogFilter.Spells, "Unit::_CreateAuraApplication() called with a removed aura. Check if OnEffectHitTarget() is triggering any spell with apply aura effect (that's not allowed!)");//\nUnit: {}\nAura: {}", GetDebugInfo().c_str(), aura->GetDebugInfo().c_str());
return null;
}
// aura mustn't be already applied on target
Cypher.Assert(!aura.IsAppliedOnTarget(GetGUID()), "Unit._CreateAuraApplication: aura musn't be applied on target");