fix(Core/Spells): don't resolve spellmod owner for casters no longer on a map (#26780)

This commit is contained in:
Andrew
2026-07-24 06:28:38 -03:00
committed by GitHub
parent 1a7b191da2
commit 0e9abcd305

View File

@@ -695,7 +695,9 @@ Spell::Spell(Unit* caster, SpellInfo const* info, TriggerCastFlags triggerFlags,
Spell::~Spell() Spell::~Spell()
{ {
if (Player* modOwner = m_caster ? m_caster->GetSpellModOwner() : nullptr) // FindMap() check: pending spell events are destroyed after the caster has left the map,
// where resolving a unit-summoned caster's owner through ObjectAccessor would assert
if (Player* modOwner = (m_caster && m_caster->FindMap()) ? m_caster->GetSpellModOwner() : nullptr)
if (modOwner->m_spellModTakingSpell == this) if (modOwner->m_spellModTakingSpell == this)
modOwner->SetSpellModTakingSpell(this, false); modOwner->SetSpellModTakingSpell(this, false);