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 actualNewChapters = newChapters.subtract(reUploadedChapters.toSet()).toList()
val chaptersToConsiderForDownloadLimit = val chaptersToConsiderForDownloadLimit =
if (serverConfig.autoDownloadIgnoreReUploads.value) { if (serverConfig.autoDownloadIgnoreReUploads.value) {
actualNewChapters.removeDuplicates(actualNewChapters[0]) if (actualNewChapters.isNotEmpty()) actualNewChapters.removeDuplicates(actualNewChapters[0]) else emptyList()
} else { } else {
newChapters.removeDuplicates(newChapters[0]) newChapters.removeDuplicates(newChapters[0])
}.sortedBy { it.index } }.sortedBy { it.index }