Skip to content

Commit 3239e61

Browse files
committed
Fix NPE that can rarely occur when debugging inventories
1 parent 90e9c3a commit 3239e61

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

core/src/main/java/org/geysermc/geyser/util/InventoryUtils.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,9 +493,12 @@ public static String debugInventory(@Nullable Inventory inventory) {
493493
return "null";
494494
}
495495

496+
String inventoryType = inventory.getContainerType() != null ?
497+
inventory.getContainerType().name() : "null";
498+
496499
return inventory.getClass().getSimpleName() + ": javaId=" + inventory.getJavaId() +
497500
", bedrockId=" + inventory.getBedrockId() + ", size=" + inventory.getSize() +
498-
", type=" + inventory.getContainerType().name() + ", pending=" + inventory.isPending() +
501+
", type=" + inventoryType + ", pending=" + inventory.isPending() +
499502
", displayed=" + inventory.isPending() + ", delayed=" + inventory.isPending();
500503
}
501504
}

0 commit comments

Comments
 (0)