Fix downloader crash related to UnmeteredSource (#7365)

Fix crash when starting a download with chaqpters from a UnmeteredSource
This commit is contained in:
jobobby04 2022-06-25 11:09:41 -04:00 committed by GitHub
parent 33a778873a
commit 470a576441
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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