Core/Spells: Possible crash fix

Get Unit target with the proper method instead of retrieving Object target and then casting it to Unit, possible dereferencing NULL.
Updates #11560
This commit is contained in:
jackpoz
2014-02-06 22:11:06 +01:00
parent 20a1f4d28e
commit 84e73448f2

View File

@@ -3020,7 +3020,7 @@ void Spell::cast(bool skipCheck)
if (this->GetSpellInfo()->DmgClass != SPELL_DAMAGE_CLASS_NONE)
if (Pet* playerPet = playerCaster->GetPet())
if (playerPet->IsAlive() && playerPet->isControlled() && (m_targets.GetTargetMask() & TARGET_FLAG_UNIT))
playerPet->AI()->OwnerAttacked(m_targets.GetObjectTarget()->ToUnit());
playerPet->AI()->OwnerAttacked(m_targets.GetUnitTarget());
}
SetExecutedCurrently(true);