prevent / 0

pull/6896/head
Thibault Duplessis 2020-06-29 07:54:11 +02:00
parent 9248213a99
commit 9b6d83630d
1 changed files with 3 additions and 1 deletions

View File

@ -33,7 +33,9 @@ final class Paginator[A] private[paginator] (
/**
* Returns the number of pages.
*/
def nbPages: Int = (nbResults + maxPerPage.value - 1) / maxPerPage.value
def nbPages: Int =
if (maxPerPage.value > 0) (nbResults + maxPerPage.value - 1) / maxPerPage.value
else 0
/**
* Returns whether we have to paginate or not.