From adc9f4e7abe4ff29de806a3a8f20c7fd248fa661 Mon Sep 17 00:00:00 2001 From: sudlud Date: Sun, 18 Aug 2024 10:57:02 +0200 Subject: [PATCH] fix(Core/Spell): check for player before dereferencing (#19666) --- src/server/game/Spells/Spell.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 9bd266e11..ea4c3383e 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -3739,8 +3739,9 @@ void Spell::cancel(bool bySelf) if (Unit* unit = m_caster->GetGUID() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID)) unit->RemoveOwnedAura(m_spellInfo->Id, m_originalCasterGUID, 0, AURA_REMOVE_BY_CANCEL); - if (m_spellInfo->HasAttribute(SPELL_ATTR0_COOLDOWN_ON_EVENT)) - m_caster->ToPlayer()->RemoveSpellCooldown(m_spellInfo->Id, true); + if (m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_spellInfo->HasAttribute(SPELL_ATTR0_COOLDOWN_ON_EVENT)) + m_caster->ToPlayer()->RemoveSpellCooldown(m_spellInfo->Id, true); SendChannelUpdate(0); SendInterrupted(SPELL_FAILED_INTERRUPTED);