浏览代码

Fixed a map-server crash (#6223)

Fixes #6220

Thanks to @AsurielRO, @Atemo, @aleos89 and @vstumpf
Lemongrass3110 3 年之前
父节点
当前提交
21cb9e87a2
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      src/map/skill.cpp

+ 2 - 1
src/map/skill.cpp

@@ -19003,7 +19003,8 @@ void skill_clear_unitgroup(struct block_list *src)
 
 	nullpo_retv(ud);
 
-	for (auto it = ud->skillunits.begin(); it != ud->skillunits.end(); it++) {
+	// The after loop statement might look stupid, but this prevents iteration problems, if an entry was deleted
+	for (auto it = ud->skillunits.begin(); it != ud->skillunits.end(); it = ud->skillunits.begin()) {
 		skill_delunitgroup(*it);
 	}
 }