Skip to content

Commit

Permalink
Prevent IndexOutOfBoundsException when removing duplicated chapters (#…
Browse files Browse the repository at this point in the history
…935)

In case the "new" chapters consisted only of re-uploads an out of bound exception was thrown
  • Loading branch information
schroda authored Apr 28, 2024
1 parent 72b1b5b commit 668d5cf
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down

0 comments on commit 668d5cf

Please sign in to comment.