Skip to content

Commit

Permalink
Fix potential NPE (#352)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinthegreat1 authored Oct 10, 2023
1 parent a373db6 commit b42557e
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@ public void drawItems(TextRenderer textRenderer, int x, int y, DrawContext conte
context.drawTexture(INVENTORY_TEXTURE, x + 7 + dimensions.rightInt() * 18, y + 7 + dimensions.leftInt() * 18, 169, 25, 7, 7);

for (IntObjectPair<ItemStack> entry : items) {
int itemX = x + entry.leftInt() % dimensions.rightInt() * 18 + 8;
int itemY = y + entry.leftInt() / dimensions.rightInt() * 18 + 8;
context.drawItem(entry.right(), itemX, itemY);
context.drawItemInSlot(textRenderer, entry.right(), itemX, itemY);
if (entry.right() != null) {
int itemX = x + entry.leftInt() % dimensions.rightInt() * 18 + 8;
int itemY = y + entry.leftInt() / dimensions.rightInt() * 18 + 8;
context.drawItem(entry.right(), itemX, itemY);
context.drawItemInSlot(textRenderer, entry.right(), itemX, itemY);
}
}
}
}

0 comments on commit b42557e

Please sign in to comment.