From 5e091ec4f1903bfb9bfa735049b56888aa84c0d1 Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Sun, 21 Apr 2024 04:13:06 +0200 Subject: [PATCH] Prevent IndexOutOfBoundsException when removing duplicated chapters In case the "new" chapters consisted only of re-uploads an out of bound exception was thrown --- server/src/main/kotlin/suwayomi/tachidesk/manga/impl/Chapter.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/main/kotlin/suwayomi/tachidesk/manga/impl/Chapter.kt b/server/src/main/kotlin/suwayomi/tachidesk/manga/impl/Chapter.kt index 22e75f3190..2e89606233 100644 --- a/server/src/main/kotlin/suwayomi/tachidesk/manga/impl/Chapter.kt +++ b/server/src/main/kotlin/suwayomi/tachidesk/manga/impl/Chapter.kt @@ -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 }