From 20e81073aae2833682aa3f2fd4c8a2fd8734532d Mon Sep 17 00:00:00 2001 From: Jay Date: Sun, 9 Aug 2020 17:45:56 -0400 Subject: [PATCH] Fix crash when canceling library update with new chapters --- .../kanade/tachiyomi/data/library/LibraryUpdateNotifier.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateNotifier.kt b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateNotifier.kt index d917161a3d..766ddf2f14 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateNotifier.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateNotifier.kt @@ -28,6 +28,7 @@ import eu.kanade.tachiyomi.util.system.notificationBuilder import eu.kanade.tachiyomi.util.system.notificationManager import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.launch +import okhttp3.internal.toImmutableMap import uy.kohesive.injekt.injectLazy import java.util.ArrayList @@ -121,7 +122,9 @@ class LibraryUpdateNotifier(private val context: Context) { * * @param updates a list of manga with new updates. */ - fun showResultNotification(updates: Map>) { + fun showResultNotification(newUpdates: Map>) { + // create a copy of the list since it will be cleared by the time it is used + val updates = newUpdates.toImmutableMap() GlobalScope.launch { val notifications = ArrayList>() updates.forEach {