Skip to content

Commit b69a617

Browse files
committed
fixed concurrent modification exception
1 parent d59d6e2 commit b69a617

File tree

1 file changed

+4
-2
lines changed
  • common/src/main/kotlin/com/lambda/interaction/request/breaking

1 file changed

+4
-2
lines changed

common/src/main/kotlin/com/lambda/interaction/request/breaking/BreakManager.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,10 +320,12 @@ object BreakManager : RequestHandler<BreakRequest>(
320320
* @see atMaxBreakInfos
321321
*/
322322
private fun SafeContext.processNewBreaks(request: BreakRequest): Boolean {
323-
breaks.forEach { ctx ->
323+
val iterator = breaks.iterator()
324+
while (iterator.hasNext()) {
325+
val ctx = iterator.next()
324326
initNewBreak(ctx, request) ?: return false
325327
request.onAccept?.invoke(ctx.expectedPos)
326-
breaks.remove(ctx)
328+
iterator.remove()
327329
if (atMaxBreakInfos(request.build.breaking)) return false
328330
}
329331
return true

0 commit comments

Comments
 (0)