diff --git a/zone/hate_list.cpp b/zone/hate_list.cpp index aa55317bc..5cb9bc2b8 100644 --- a/zone/hate_list.cpp +++ b/zone/hate_list.cpp @@ -73,20 +73,18 @@ void HateList::WipeHateList(bool npc_only) { } } -bool HateList::IsEntOnHateList(Mob *mob) +bool HateList::IsEntOnHateList(Mob* m) { - if (Find(mob)) - return true; - return false; + return m ? Find(m) != nullptr : false; } struct_HateList* HateList::Find(Mob* m) { - if (!m) { + if (!m || list.empty()) { return nullptr; } - for (auto* e : list) { + for (auto e : list) { if (e->entity_on_hatelist && e->entity_on_hatelist == m) { return e; } diff --git a/zone/hate_list.h b/zone/hate_list.h index d87e6d393..d01b77fe5 100644 --- a/zone/hate_list.h +++ b/zone/hate_list.h @@ -48,7 +48,7 @@ public: Mob *GetMobWithMostHateOnList(bool skip_mezzed = false); Mob *GetEscapingMobOnHateList(Mob *center, float range = 0.0f, bool first = false); - bool IsEntOnHateList(Mob *mob); + bool IsEntOnHateList(Mob* m); bool IsHateListEmpty(); bool RemoveEntFromHateList(Mob *ent);