diff options
author | Anubisss <anubisss210@gmail.com> | 2011-01-12 02:06:06 +0100 |
---|---|---|
committer | Anubisss <anubisss210@gmail.com> | 2011-01-12 02:06:06 +0100 |
commit | 806794d4cef21f6a66ac456f10f77c4002b6d81c (patch) | |
tree | d563b398a0f17f56790f71b6c2ce1c39fe4b75f2 /src | |
parent | 3a7a01e7c7d9f109ab13e2516b0f5d3064dc412d (diff) |
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 <anubisss210@gmail.com>
Diffstat (limited to 'src')
-rwxr-xr-x | src/server/game/Spells/Spell.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 819ec8eb98e..9a29cd99b23 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -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; |