Core/PetAI: Add additional safeguard against possible crash if me->GetCharmerOrOwner() is NULL in agressiontest

Patch by JacB667. Fixes issue #3766.

--HG--
branch : trunk
This commit is contained in:
click
2010-09-03 22:47:03 +02:00
parent 7884fd927a
commit 128c60c84a
+2 -2
View File
@@ -328,9 +328,9 @@ Unit *PetAI::SelectNextTarget()
// to owner // to owner
if ((target = me->getAttackerForHelper()) && !_CheckTargetCC(target)) {} if ((target = me->getAttackerForHelper()) && !_CheckTargetCC(target)) {}
// Check owner's attackers if pet didn't have any // Check owner's attackers if pet didn't have any
else if ((target = me->GetCharmerOrOwner()->getAttackerForHelper()) && !_CheckTargetCC(target)) {} else if (me->GetCharmerOrOwner() && (target = me->GetCharmerOrOwner()->getAttackerForHelper()) && !_CheckTargetCC(target)) {}
// 3.0.2 - Pets now start attacking their owners target in defensive mode as soon as the hunter does // 3.0.2 - Pets now start attacking their owners target in defensive mode as soon as the hunter does
else if ((target = me->GetCharmerOrOwner()->getVictim()) && !_CheckTargetCC(target)) {} else if (me->GetCharmerOrOwner() && (target = me->GetCharmerOrOwner()->getVictim()) && !_CheckTargetCC(target)) {}
// Default // Default
else return NULL; else return NULL;