Parcourir la source

Fixed a map-server crash (#6223)

Fixes #6220

Thanks to @AsurielRO, @Atemo, @aleos89 and @vstumpf
Lemongrass3110 il y a 3 ans
Parent
commit
21cb9e87a2
1 fichiers modifiés avec 2 ajouts et 1 suppressions
  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);
 	}
 }