Skip to content

Commit

Permalink
fix: IOOBE thrown by populate page method
Browse files Browse the repository at this point in the history
  • Loading branch information
LichtHund committed Aug 5, 2024
1 parent 32cb243 commit faff78c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ subprojects {
}

group = "dev.triumphteam"
version = "3.1.10"
version = "3.1.11"

dependencies {
compileOnly("org.jetbrains:annotations:21.0.1")
Expand Down
5 changes: 5 additions & 0 deletions core/src/main/java/dev/triumphteam/gui/guis/PaginatedGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -406,8 +406,13 @@ public int getPagesNum() {
private void populatePage() {
// Adds the paginated items to the page
int slot = 0;
final int inventorySize = getInventory().getSize();
final Iterator<GuiItem> iterator = getPageNum(pageNum).iterator();
while (iterator.hasNext()) {
if (slot >= inventorySize) {
break; // Exit the loop if slot exceeds inventory size
}

if (getGuiItem(slot) != null || getInventory().getItem(slot) != null) {
slot++;
continue;
Expand Down

0 comments on commit faff78c

Please sign in to comment.