diff --git a/zone/entity.cpp b/zone/entity.cpp index 1a40ccb6a..a5654f3b5 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -2675,6 +2675,10 @@ void EntityList::RemoveAllMobs() { auto it = mob_list.begin(); while (it != mob_list.end()) { + if (!it->second) { + ++it; + continue; + } safe_delete(it->second); free_ids.push(it->first); it = mob_list.erase(it); @@ -2812,6 +2816,9 @@ bool EntityList::RemoveMob(uint16 delete_id) auto it = mob_list.find(delete_id); if (it != mob_list.end()) { + if (!it->second) { + return false; + } if (npc_list.count(delete_id)) { entity_list.RemoveNPC(delete_id); }