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:
Anubisss
2011-01-12 02:06:06 +01:00
parent 3a7a01e7c7
commit 806794d4ce
+1
View File
@@ -5463,6 +5463,7 @@ SpellCastResult Spell::CheckCast(bool strict)
}
case SPELL_EFFECT_TALENT_SPEC_SELECT:
// can't change during already started arena/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;