mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-14 15:41:30 +00:00
Fix issue where npc_types could become null in the cache but remain referenced, causing a crash due to invalid memory accessed
This commit is contained in:
parent
eacd2c2cde
commit
42781036a8
@ -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;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user