I keep seeing a crash due to an invalidated iter during mob delete every few days, seeing if this fixes it.

This commit is contained in:
KimLS 2014-09-24 19:46:53 -07:00
parent 7feb531ff7
commit ec8c46abfe

View File

@ -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;
}