Skip to content

Commit 69c15a3

Browse files
authored
Merge pull request #713 from gitlab4j/issue-658
Fix #658 : Pager not working properly
2 parents db8f925 + 4e9f7a6 commit 69c15a3

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/main/java/org/gitlab4j/api/Pager.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -306,12 +306,6 @@ public List<T> current() throws GitLabApiException {
306306
*/
307307
public List<T> page(int pageNumber) {
308308

309-
if (pageNumber > totalPages && pageNumber > kaminariNextPage) {
310-
throw new NoSuchElementException();
311-
} else if (pageNumber < 1) {
312-
throw new NoSuchElementException();
313-
}
314-
315309
if (currentPage == 0 && pageNumber == 1) {
316310
currentPage = 1;
317311
return (currentItems);
@@ -321,6 +315,12 @@ public List<T> page(int pageNumber) {
321315
return (currentItems);
322316
}
323317

318+
if (pageNumber > totalPages && pageNumber > kaminariNextPage) {
319+
throw new NoSuchElementException();
320+
} else if (pageNumber < 1) {
321+
throw new NoSuchElementException();
322+
}
323+
324324
try {
325325

326326
setPageParam(pageNumber);

0 commit comments

Comments
 (0)