From c20ee36384902181029c2ac18ce944bf6409fe22 Mon Sep 17 00:00:00 2001 From: Orkun Duman Date: Tue, 10 Dec 2024 14:55:20 -0500 Subject: [PATCH] Avoid ConcurrentModificationException --- .../main/kotlin/com/gdelataillade/alarm/api/AlarmApiImpl.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/android/src/main/kotlin/com/gdelataillade/alarm/api/AlarmApiImpl.kt b/android/src/main/kotlin/com/gdelataillade/alarm/api/AlarmApiImpl.kt index 43d14edd..d2c614ec 100644 --- a/android/src/main/kotlin/com/gdelataillade/alarm/api/AlarmApiImpl.kt +++ b/android/src/main/kotlin/com/gdelataillade/alarm/api/AlarmApiImpl.kt @@ -62,7 +62,8 @@ class AlarmApiImpl(private val context: Context) : AlarmApi { for (alarm in AlarmStorage(context).getSavedAlarms()) { stopAlarm(alarm.id.toLong()) } - for (alarmId in alarmIds.toList()) { + val alarmIdsCopy = alarmIds.toList() + for (alarmId in alarmIdsCopy) { stopAlarm(alarmId.toLong()) } }