Core/Spells: fix a crash.

This commit is contained in:
QAston
2011-08-20 09:49:18 +02:00
parent cf4e19cf4b
commit 580a68573f
+5 -2
View File
@@ -5464,7 +5464,8 @@ SpellCastResult Spell::CheckPetCast(Unit* target)
Unit* _target = m_targets.GetUnitTarget();
if (_target) //for target dead/target not valid
// for target dead/target not valid
if (_target)
{
if (!_target->isAlive())
return SPELL_FAILED_BAD_TARGETS;
@@ -5472,8 +5473,10 @@ SpellCastResult Spell::CheckPetCast(Unit* target)
if (!IsValidSingleTargetSpell(_target))
return SPELL_FAILED_BAD_TARGETS;
}
// cooldown
if (m_caster->ToCreature()->HasSpellCooldown(m_spellInfo->Id))
if (Unit const* creatureCaster = m_caster->ToCreature())
creatureCaster->HasSpellCooldown(m_spellInfo->Id))
return SPELL_FAILED_NOT_READY;
return CheckCast(true);