Fix a crash in Spell::CheckCast().
This crash happens when effect is SPELL_EFFECT_TALENT_SPEC_SELECT and the caster is not a player. You should always check object's type (or sure that object is 101% a player) before you use ToPlayer() casting function. Signed-off-by: Anubisss <[email protected]>
This commit is contained in:
@@ -5463,6 +5463,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||||||
}
|
}
|
||||||
case SPELL_EFFECT_TALENT_SPEC_SELECT:
|
case SPELL_EFFECT_TALENT_SPEC_SELECT:
|
||||||
// can't change during already started arena/battleground
|
// can't change during already started arena/battleground
|
||||||
|
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||||
if (Battleground const* bg = m_caster->ToPlayer()->GetBattleground())
|
if (Battleground const* bg = m_caster->ToPlayer()->GetBattleground())
|
||||||
if (bg->GetStatus() == STATUS_IN_PROGRESS)
|
if (bg->GetStatus() == STATUS_IN_PROGRESS)
|
||||||
return SPELL_FAILED_NOT_IN_BATTLEGROUND;
|
return SPELL_FAILED_NOT_IN_BATTLEGROUND;
|
||||||
|
|||||||
Reference in New Issue
Block a user