Browse Source

Reappropriate my previous fix on map_foreachiddb, it's npc_unload's problem.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@5647 54d463be-8e91-2dee-dedb-b68131a5f0ec
Lance 19 years ago
parent
commit
1c65124338
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/map/npc.c

+ 3 - 1
src/map/npc.c

@@ -1532,7 +1532,10 @@ static int npc_unload_ev(DBKey key,void *data,va_list ap) {
 
 int npc_unload (struct npc_data *nd)
 {
+	nullpo_retv(nd);
+
 	npc_remove_map (nd);
+	map_deliddb(&nd->bl);
 
 	if (nd->chat_id) {
 		struct chat_data *cd = (struct chat_data*)map_id2bl(nd->chat_id);
@@ -2794,7 +2797,6 @@ static int npc_cleanup_sub (struct block_list *bl, va_list ap) {
 }
 
 static int npc_cleanup_dbsub(DBKey key,void * data,va_list app) {
-	map_deliddb((struct block_list*)data);
 	return npc_cleanup_sub((struct block_list*)data, 0);
 }