diff --git a/zone/zone.cpp b/zone/zone.cpp index c9342f305..a98c70c73 100755 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -773,12 +773,14 @@ void Zone::Shutdown(bool quiet) while (!zone->npctable.empty()) { itr = zone->npctable.begin(); delete itr->second; + itr->second = nullptr; zone->npctable.erase(itr); } while (!zone->merctable.empty()) { itr = zone->merctable.begin(); delete itr->second; + itr->second = nullptr; zone->merctable.erase(itr); } @@ -788,6 +790,7 @@ void Zone::Shutdown(bool quiet) while (!zone->ldon_trap_list.empty()) { itr4 = zone->ldon_trap_list.begin(); delete itr4->second; + itr4->second = nullptr; zone->ldon_trap_list.erase(itr4); } zone->ldon_trap_entry_list.clear(); @@ -1583,6 +1586,7 @@ bool Zone::Depop(bool StartSpawnTimer) { while(!npctable.empty()) { itr = npctable.begin(); delete itr->second; + itr->second = nullptr; npctable.erase(itr); } @@ -1599,6 +1603,7 @@ void Zone::ClearNPCTypeCache(int id) { auto iter = npctable.begin(); while (iter != npctable.end()) { delete iter->second; + iter->second = nullptr; ++iter; } npctable.clear(); @@ -1608,6 +1613,7 @@ void Zone::ClearNPCTypeCache(int id) { while (iter != npctable.end()) { if (iter->first == (uint32)id) { delete iter->second; + iter->second = nullptr; npctable.erase(iter); return; }