From 9372d173130522ae3743ea969bd45412a1d883d2 Mon Sep 17 00:00:00 2001 From: dankito Date: Mon, 9 Sep 2024 17:02:47 +0200 Subject: [PATCH] Avoiding concurrent modification exception --- .../kotlin/net/codinux/banking/fints/model/TanChallenge.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/model/TanChallenge.kt b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/model/TanChallenge.kt index 5a8b6215..66c2791e 100644 --- a/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/model/TanChallenge.kt +++ b/fints4k/src/commonMain/kotlin/net/codinux/banking/fints/model/TanChallenge.kt @@ -43,7 +43,7 @@ open class TanChallenge( internal fun userApprovedDecoupledTan(responseAfterApprovingDecoupledTan: BankResponse) { this.enterTanResult = EnterTanResult(null, true, responseAfterApprovingDecoupledTan) - userApprovedDecoupledTanCallbacks.forEach { + userApprovedDecoupledTanCallbacks.toTypedArray().forEach { // copy to avoid ConcurrentModificationException try { it.invoke() } catch (e: Throwable) { @@ -60,7 +60,7 @@ open class TanChallenge( } internal fun tanExpired() { - tanExpiredCallbacks.forEach { + tanExpiredCallbacks.toTypedArray().forEach { try { it.invoke() } catch (e: Throwable) {