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 .
This commit is contained in:
jackpoz
2014-04-19 21:48:22 +02:00
parent fac3f445b1
commit 8ca6371793
39 changed files with 73 additions and 67 deletions

View File

@@ -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