fixes in pagintion

This commit is contained in:
InsanusMokrassar 2020-11-03 18:37:50 +06:00
parent 8023fa1b76
commit 35913b95be
2 changed files with 4 additions and 1 deletions

View File

@ -2,6 +2,9 @@
## 0.2.6
* `Pagination`
* Fixes in function `List#paginate`
## 0.2.5
* `Coroutines`

View File

@ -21,7 +21,7 @@ fun <T> Iterable<T>.paginate(with: Pagination): PaginationResult<T> {
}
fun <T> List<T>.paginate(with: Pagination): PaginationResult<T> {
return subList(with.firstIndex, with.lastIndex + 1).createPaginationResult(
return subList(maxOf(with.firstIndex, 0), (minOf(with.lastIndex, lastIndex)) + 1).createPaginationResult(
with,
size.toLong()
)