[Fix] Handle bad offset on Paging by reducing offset to Paging.size

This commit is contained in:
Robert von Burg 2019-01-04 15:34:31 +01:00
parent 40a60c86da
commit b0bc2fce0d
1 changed files with 6 additions and 0 deletions

View File

@ -135,6 +135,12 @@ public class Paging<T> {
return paging;
}
// can happen if elements were removed and the user didn't see that, i.e. pressing next on a page that doesn't exist anymore
if (offset > paging.size) {
offset = paging.size;
paging.offset = offset;
}
paging.page = list.subList(offset, Math.min(paging.size, offset + limit));
if (limit == 1) {