diff options
Diffstat (limited to 'src/map/npc.cpp')
-rw-r--r-- | src/map/npc.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/map/npc.cpp b/src/map/npc.cpp index 2600117..32a5a54 100644 --- a/src/map/npc.cpp +++ b/src/map/npc.cpp @@ -675,6 +675,9 @@ int npc_touch_areanpc(dumb_ptr<map_session_data> sd, Borrowed<map_local> m, int for (i = 0; i < m->npc_num; i++) { + if (m->npc[i] == nullptr) + continue; + if (m->npc[i]->flag & 1) continue; @@ -1046,6 +1049,11 @@ void npc_free_internal(dumb_ptr<npc_data> nd_) } if (nd_->name) npcs_by_name.put(nd_->name, nullptr); + + if (nd_->bl_m != borrow(undefined_gat)) { + nd_->bl_m->npc[nd_->n] = nullptr; + } + nd_.delete_(); } |