aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclick <none@none>2010-09-03 22:47:03 +0200
committerclick <none@none>2010-09-03 22:47:03 +0200
commit128c60c84ad1e11a8cf27f1ffb983052dbc9a82d (patch)
treeb5ecd20330596376223cc2f93f66f9c235fa7cfc
parent7884fd927a3810a7429021f8badf528276b55ef9 (diff)
Core/PetAI: Add additional safeguard against possible crash if me->GetCharmerOrOwner() is NULL in agressiontest
Patch by JacB667. Fixes issue #3766. --HG-- branch : trunk
-rw-r--r--src/server/game/AI/CoreAI/PetAI.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp
index d3c7cd7c6dd..bd5b45bdf3b 100644
--- a/src/server/game/AI/CoreAI/PetAI.cpp
+++ b/src/server/game/AI/CoreAI/PetAI.cpp
@@ -328,9 +328,9 @@ Unit *PetAI::SelectNextTarget()
// to owner
if ((target = me->getAttackerForHelper()) && !_CheckTargetCC(target)) {}
// 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
- else if ((target = me->GetCharmerOrOwner()->getVictim()) && !_CheckTargetCC(target)) {}
+ else if (me->GetCharmerOrOwner() && (target = me->GetCharmerOrOwner()->getVictim()) && !_CheckTargetCC(target)) {}
// Default
else return NULL;