[Fix] Handle bad offset on Paging by reducing offset to Paging.size
This commit is contained in:
parent
40a60c86da
commit
b0bc2fce0d
|
@ -135,6 +135,12 @@ public class Paging<T> {
|
||||||
return paging;
|
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));
|
paging.page = list.subList(offset, Math.min(paging.size, offset + limit));
|
||||||
|
|
||||||
if (limit == 1) {
|
if (limit == 1) {
|
||||||
|
|
Loading…
Reference in New Issue