Fixed an NPE happening when the user tries to get empty review list

This commit is contained in:
Sergey Eremin
2017-10-17 19:12:47 +03:00
parent f9812949b6
commit da3ebefee6

View File

@@ -46,7 +46,8 @@ public class ReviewStorageIterator extends ReviewIterator {
}
private List<Review> current() {
int offset = PAGE_SIZE * page;
return list.subList(offset, offset + PAGE_SIZE);
int from = PAGE_SIZE * page;
int to = from + PAGE_SIZE;
return (from < 0 || to > list.size()) ? new ArrayList<Review>() : list.subList(from, to);
}
}