Prevent IndexOutOfBoundsException when removing duplicated chapters (#935)

In case the "new" chapters consisted only of re-uploads an out of bound exception was thrown
This commit is contained in:
schroda
2024-04-28 02:33:30 +02:00
committed by GitHub
parent 72b1b5b0f9
commit 668d5cf8f0

View File

@@ -370,7 +370,7 @@ object Chapter {
val actualNewChapters = newChapters.subtract(reUploadedChapters.toSet()).toList()
val chaptersToConsiderForDownloadLimit =
if (serverConfig.autoDownloadIgnoreReUploads.value) {
actualNewChapters.removeDuplicates(actualNewChapters[0])
if (actualNewChapters.isNotEmpty()) actualNewChapters.removeDuplicates(actualNewChapters[0]) else emptyList()
} else {
newChapters.removeDuplicates(newChapters[0])
}.sortedBy { it.index }