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,9 +5463,10 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
}
|
||||
case SPELL_EFFECT_TALENT_SPEC_SELECT:
|
||||
// can't change during already started arena/battleground
|
||||
if (Battleground const* bg = m_caster->ToPlayer()->GetBattleground())
|
||||
if (bg->GetStatus() == STATUS_IN_PROGRESS)
|
||||
return SPELL_FAILED_NOT_IN_BATTLEGROUND;
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
if (Battleground const* bg = m_caster->ToPlayer()->GetBattleground())
|
||||
if (bg->GetStatus() == STATUS_IN_PROGRESS)
|
||||
return SPELL_FAILED_NOT_IN_BATTLEGROUND;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user