diff --git a/changelog.txt b/changelog.txt index ff2dc1d1c..08d664a70 100644 --- a/changelog.txt +++ b/changelog.txt @@ -4,6 +4,7 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) Secrets: Changed the functionality of EQDEBUG cmake flag. It now suppresses logs, but shows crashes in any scenario when set to 1. It will also now show crashes even if the log system is disabled. KLS: Change to how quest signals work, signals with no delay will now be added to the signal queue. This addresses an odd timing issue where NPCs are in a state of life/death flux when a signal from event_death goes off. KLS: Added cmake flags to define how logging behavior works for each different log type. +Secrets: Crash fix for Hatelist crash observed == 04/18/2014 == Akkadius: Added #command error message suppression for those who don't want to see 'Command is not recognized' constantly diff --git a/zone/hate_list.cpp b/zone/hate_list.cpp index 7f986949b..2fbc528fc 100644 --- a/zone/hate_list.cpp +++ b/zone/hate_list.cpp @@ -445,6 +445,17 @@ Mob *HateList::GetMostHate(){ Mob *HateList::GetRandom() { int count = list.size(); + if(count == 0) //If we don't have any entries it'll crash getting a random 0, -1 position. + return NULL; + + if(count == 1) //No need to do all that extra work if we only have one hate entry + { + if(*list.begin()) // Just in case tHateEntry is invalidated somehow... + return (*list.begin())->ent; + + return NULL; + } + auto iterator = list.begin(); int random = MakeRandomInt(0, count - 1); for (int i = 0; i < random; i++)