mirror of
https://github.com/Suwayomi/Tachidesk.git
synced 2025-12-23 13:02:34 +01:00
Prevent chapter lastReadPage coerceIn error (#1272)
coerceIn throws an error in case the max value is less than the min value ("Cannot coerce value to an empty range: maximum <max> is less than minimum <min>")
Regression from c8bd39b4bf
This commit is contained in:
@@ -85,7 +85,7 @@ class ChapterMutation {
|
|||||||
this[ChapterTable.isBookmarked] = it
|
this[ChapterTable.isBookmarked] = it
|
||||||
}
|
}
|
||||||
patch.lastPageRead?.also {
|
patch.lastPageRead?.also {
|
||||||
this[ChapterTable.lastPageRead] = it.coerceIn(0, chapterIdToPageCount[chapterId])
|
this[ChapterTable.lastPageRead] = it.coerceAtMost(chapterIdToPageCount[chapterId] ?: 0).coerceAtLeast(0)
|
||||||
this[ChapterTable.lastReadAt] = now
|
this[ChapterTable.lastReadAt] = now
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ private class ChapterForDownload(
|
|||||||
ChapterTable.update({ ChapterTable.id eq chapterId }) {
|
ChapterTable.update({ ChapterTable.id eq chapterId }) {
|
||||||
val pageCount = pageList.size
|
val pageCount = pageList.size
|
||||||
it[ChapterTable.pageCount] = pageCount
|
it[ChapterTable.pageCount] = pageCount
|
||||||
it[ChapterTable.lastPageRead] = chapterEntry[ChapterTable.lastPageRead].coerceIn(0, pageCount - 1)
|
it[ChapterTable.lastPageRead] = chapterEntry[ChapterTable.lastPageRead].coerceAtMost(pageCount - 1).coerceAtLeast(0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user