From a778c8033f7418a9c25ea55869e1132f79869246 Mon Sep 17 00:00:00 2001 From: Shauren Date: Mon, 18 Jul 2016 20:26:05 +0200 Subject: [PATCH] Core/Spells: Fixed possible null pointer dereference Coverity CID 1357406 (cherry picked from commit cc07a491f64fa958c8a27079bd2def84c577f816) --- src/server/game/Entities/Unit/Unit.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 9e93a1b8d5..1ddceb3a22 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -11647,7 +11647,7 @@ float Unit::GetSpellMaxRangeForTarget(Unit const* target, SpellInfo const* spell return 0; if (spellInfo->RangeEntry->maxRangeFriend == spellInfo->RangeEntry->maxRangeHostile) return spellInfo->GetMaxRange(); - if (target == NULL) + if (!target) return spellInfo->GetMaxRange(true); return spellInfo->GetMaxRange(!IsHostileTo(target)); } @@ -11658,6 +11658,8 @@ float Unit::GetSpellMinRangeForTarget(Unit const* target, SpellInfo const* spell return 0; if (spellInfo->RangeEntry->minRangeFriend == spellInfo->RangeEntry->minRangeHostile) return spellInfo->GetMinRange(); + if (!target) + return spellInfo->GetMinRange(true); return spellInfo->GetMinRange(!IsHostileTo(target)); }