diff --git a/demo/src/main/java/com/github/chantsune/swipetoaction/demo/mail/repository/MailRepository.kt b/demo/src/main/java/com/github/chantsune/swipetoaction/demo/mail/repository/MailRepository.kt index 3770274..76d2f96 100644 --- a/demo/src/main/java/com/github/chantsune/swipetoaction/demo/mail/repository/MailRepository.kt +++ b/demo/src/main/java/com/github/chantsune/swipetoaction/demo/mail/repository/MailRepository.kt @@ -14,7 +14,10 @@ class MailRepository : IMailRepository { } override suspend fun getList(page: Int, size: Int): List { - return mailList.subList(page * size, (page + 1) * size).toList() + return mailList.subList( + (page * size).coerceAtMost(mailList.size - 1), + ((page + 1) * size).coerceAtMost(mailList.size - 1), + ).toList() } override suspend fun delete(mail: Mail) {