From ec8c46abfe3775bf5e08cff432b4bf28886b8779 Mon Sep 17 00:00:00 2001 From: KimLS Date: Wed, 24 Sep 2014 19:46:53 -0700 Subject: [PATCH] I keep seeing a crash due to an invalidated iter during mob delete every few days, seeing if this fixes it. --- zone/entity.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 8d21262c6..243bf99f5 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -497,7 +497,6 @@ void EntityList::MobProcess() if (!it->second->Process()) { Mob *mob = it->second; uint16 tempid = it->first; - ++it; // we don't erase here because the destructor will if (mob->IsNPC()) { entity_list.RemoveNPC(mob->CastToNPC()->GetID()); } else if (mob->IsMerc()) { @@ -525,7 +524,12 @@ void EntityList::MobProcess() } entity_list.RemoveClient(mob->GetID()); } - entity_list.RemoveMob(tempid); + + if(entity_list.RemoveMob(tempid)) { + it = mob_list.begin(); + } else { + ++it; + } } else { ++it; }