From b42557eb897dda3ce161b7c66b8750fd7f5ee44b Mon Sep 17 00:00:00 2001 From: Kevin <92656833+kevinthegreat1@users.noreply.github.com> Date: Tue, 10 Oct 2023 16:43:39 -0400 Subject: [PATCH] Fix potential NPE (#352) --- .../item/CompactorPreviewTooltipComponent.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/hysky/skyblocker/skyblock/item/CompactorPreviewTooltipComponent.java b/src/main/java/de/hysky/skyblocker/skyblock/item/CompactorPreviewTooltipComponent.java index f36345488b..513d7d7215 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/item/CompactorPreviewTooltipComponent.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/item/CompactorPreviewTooltipComponent.java @@ -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 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); + } } } }