From 501a743ff931be2dcedd4e9f328094af6ee8bf0a Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Mon, 24 May 2021 12:34:02 +0200 Subject: [PATCH] Fix NPE Signed-off-by: Chaoscaot --- .../features/world/InventoryListener_15.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/BauSystem_15/src/de/steamwar/bausystem/features/world/InventoryListener_15.java b/BauSystem_15/src/de/steamwar/bausystem/features/world/InventoryListener_15.java index 7160055c..cb5ba25d 100644 --- a/BauSystem_15/src/de/steamwar/bausystem/features/world/InventoryListener_15.java +++ b/BauSystem_15/src/de/steamwar/bausystem/features/world/InventoryListener_15.java @@ -32,12 +32,13 @@ public class InventoryListener_15 { public static boolean checkItemStack(ItemStack item) { net.minecraft.server.v1_15_R1.ItemStack nmsItem = CraftItemStack.asNMSCopy(item); NBTTagCompound tag = nmsItem.getTag(); - assert tag != null; - NBTTagCompound blockTag = tag.getCompound("BlockEntityTag"); - assert blockTag != null; - if (blockTag.hasKey("Items")) { - return drillDown(blockTag.getList("Items", 10), 0, 0) > threshold; + if (tag != null && tag.hasKey("BlockEntityTag")) { + NBTTagCompound blockTag = tag.getCompound("BlockEntityTag"); + if (blockTag.hasKey("Items")) { + return drillDown(blockTag.getList("Items", 10), 0, 0) > threshold; + } } + return false; }