From ae2556ec8fcbfed9e18d275a578f4bc47d26f721 Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Sun, 21 Apr 2024 06:43:43 +0000 Subject: DB: Maybe fix concurrent modification --- src/map/npc.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src/map/npc.cpp') diff --git a/src/map/npc.cpp b/src/map/npc.cpp index efb2ba3..76f0e14 100644 --- a/src/map/npc.cpp +++ b/src/map/npc.cpp @@ -1053,13 +1053,9 @@ void npc_free_internal(dumb_ptr nd_) // Also clean up any events we registered to the global ev_db if (auto nd = nd_->is_script()) { - for (auto& pair : ev_db) - { - if (pair.second.nd == nd) - { - ev_db.erase(pair.first); - } - } + ev_db.erase_if([&](auto& pair) { + return pair.second.nd == nd; + }); } nd_.delete_(); -- cgit v1.2.3-60-g2f50