From 29ced9642d63df956f07904011b19e4b272091d4 Mon Sep 17 00:00:00 2001 From: jobobby04 Date: Sat, 25 Jun 2022 11:09:41 -0400 Subject: [PATCH] Fix downloader crash related to UnmeteredSource (#7365) Fix crash when starting a download with chaqpters from a UnmeteredSource (cherry picked from commit 470a5764417ccd63a274ccea0e483a12ec1adbda) --- .../main/java/eu/kanade/tachiyomi/data/download/Downloader.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt index e2f84f646..732a1c2bc 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt @@ -278,7 +278,8 @@ class Downloader( val maxDownloadsFromSource = queue .groupBy { it.source } .filterKeys { it !is UnmeteredSource } - .maxOf { it.value.size } + .maxOfOrNull { it.value.size } + ?: 0 if ( queuedDownloads > DOWNLOADS_QUEUED_WARNING_THRESHOLD || maxDownloadsFromSource > CHAPTERS_PER_SOURCE_QUEUE_WARNING_THRESHOLD