From eba74d7799b5a882627e2b9729d62c591bbb080f Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 7 Nov 2017 23:29:06 +0100 Subject: [PATCH] fix a concurrent modification exception --- .../main/kotlin/com/simplemobiletools/draw/models/MyPath.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/draw/models/MyPath.kt b/app/src/main/kotlin/com/simplemobiletools/draw/models/MyPath.kt index 3c8766e..049d467 100644 --- a/app/src/main/kotlin/com/simplemobiletools/draw/models/MyPath.kt +++ b/app/src/main/kotlin/com/simplemobiletools/draw/models/MyPath.kt @@ -15,14 +15,14 @@ import java.util.* // https://stackoverflow.com/a/8127953 class MyPath : Path(), Serializable { - val actions = LinkedList() private fun readObject(inputStream: ObjectInputStream) { inputStream.defaultReadObject() - for (action in actions) { - action.perform(this) + val copiedActions = actions.map { it } + copiedActions.forEach { + it.perform(this) } }