aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/AI/ScriptedAI
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2014-04-19 21:48:22 +0200
committerjackpoz <giacomopoz@gmail.com>2014-04-19 21:48:22 +0200
commit8ca63717932ae6db48d74e866e8d379c4f5a5920 (patch)
tree0ebd6fa6ded2af7c4becaae1bb372be427235c6d /src/server/game/AI/ScriptedAI
parentfac3f445b12ee9ab484a2c229cdd49ca68120cea (diff)
Core/Misc: Ensure GetVictim() returns a valid reference when expected
Add a new method EnsureVictim() which asserts a valid not NULL reference will be returned to the caller. Use this whenever the GetVictim() would be dereferenced .
Diffstat (limited to 'src/server/game/AI/ScriptedAI')
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp2
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
index dcf5bd56fa6..43596ffb4cb 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
@@ -77,7 +77,7 @@ bool npc_escortAI::AssistPlayerInCombat(Unit* who)
return false;
//not a player
- if (!who->GetVictim()->GetCharmerOrOwnerPlayerOrPlayerItself())
+ if (!who->EnsureVictim()->GetCharmerOrOwnerPlayerOrPlayerItself())
return false;
//never attack friendly
diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
index 0fbfc2cebac..df6bee51642 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
@@ -74,7 +74,7 @@ bool FollowerAI::AssistPlayerInCombat(Unit* who)
return false;
//not a player
- if (!who->GetVictim()->GetCharmerOrOwnerPlayerOrPlayerItself())
+ if (!who->EnsureVictim()->GetCharmerOrOwnerPlayerOrPlayerItself())
return false;
//never attack friendly