Skip to content

Commit bede487

Browse files
authored
Merge pull request #4 from stijnb1234/patch-1
Added null check to onPageChange
2 parents f8b9f89 + 23f5575 commit bede487

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/com/samjakob/spigui/SGMenu.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ public boolean nextPage(HumanEntity viewer) {
440440
if (currentPage < getMaxPage() - 1) {
441441
currentPage++;
442442
refreshInventory(viewer);
443-
this.onPageChange.accept(this);
443+
if (this.onPageChange != null) this.onPageChange.accept(this);
444444
return true;
445445
} else {
446446
return false;
@@ -459,7 +459,7 @@ public boolean previousPage(HumanEntity viewer) {
459459
if (currentPage > 0) {
460460
currentPage--;
461461
refreshInventory(viewer);
462-
this.onPageChange.accept(this);
462+
if (this.onPageChange != null) this.onPageChange.accept(this);
463463
return true;
464464
} else {
465465
return false;

0 commit comments

Comments
 (0)