From 899e6760e1468c2fbd7093715cfb852797f6b177 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 22 Oct 2020 18:48:05 +0600 Subject: [PATCH] fix for lastIndex in reversing of pagination --- .../inmo/micro_utils/pagination/utils/PaginationReversing.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pagination/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/utils/PaginationReversing.kt b/pagination/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/utils/PaginationReversing.kt index 3b7247c3e12..07104445e8c 100644 --- a/pagination/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/utils/PaginationReversing.kt +++ b/pagination/common/src/commonMain/kotlin/dev/inmo/micro_utils/pagination/utils/PaginationReversing.kt @@ -19,7 +19,7 @@ fun Pagination.reverse(datasetSize: Long): SimplePagination { newPage, size ).let { - if (it.lastIndex > datasetSize) { + if (it.lastIndex >= datasetSize) { it.copy(size = (datasetSize - firstIndex - 1).toInt()) } else { it