Skip to content

Commit

Permalink
Fix crashing when reordering downloads
Browse files Browse the repository at this point in the history
  • Loading branch information
FooIbar committed Sep 10, 2023
1 parent 6f22269 commit 6bfa8d1
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,11 @@ object DownloadManager : OnSpiderListener {
fun moveDownload(fromItem: DownloadInfo, toItem: DownloadInfo): List<DownloadInfo> {
val fromPosition = allInfoList.indexOf(fromItem)
val toPosition = allInfoList.indexOf(toItem)
return moveDownload(fromPosition, toPosition)
return if (fromPosition != -1 && toPosition != -1) {
moveDownload(fromPosition, toPosition)
} else {
emptyList()
}
}

suspend fun resetAllReadingProgress() = coroutineScope {
Expand Down

0 comments on commit 6bfa8d1

Please sign in to comment.