From b19ddaa521e2225f46b4450fe16c76698d207fa9 Mon Sep 17 00:00:00 2001 From: Pablo Herrera Date: Mon, 7 Oct 2024 02:54:35 +0200 Subject: [PATCH] Fix NPE on inventory interact Signed-off-by: Pablo Herrera --- core/src/main/java/tc/oc/pgm/spawns/states/Observing.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/tc/oc/pgm/spawns/states/Observing.java b/core/src/main/java/tc/oc/pgm/spawns/states/Observing.java index 6873c973d0..e086be4c0e 100644 --- a/core/src/main/java/tc/oc/pgm/spawns/states/Observing.java +++ b/core/src/main/java/tc/oc/pgm/spawns/states/Observing.java @@ -137,8 +137,9 @@ public void onEvent(EntityDamageEvent event) { public void onEvent(InventoryClickEvent event) { super.onEvent(event); - if (!(event.getClickedInventory() instanceof PlayerInventory - || event.getClickedInventory().getType() == InventoryType.CRAFTING) + var inv = event.getInventory(); + if (inv == null + || !(inv instanceof PlayerInventory || inv.getType() == InventoryType.CRAFTING) || event.getCursor() == null) return; ItemStack item = event.getCursor();