Skip to content

Commit

Permalink
Fix NPE issue
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed Mar 5, 2025
1 parent be672f4 commit 6cb6a02
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/main/java/world/bentobox/bentobox/hooks/ItemsAdderHook.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,13 @@ public static String getInCustomRegion(Location loc) {
*/
public static Optional<ItemStack> getItemStack(String namespacedId) {
CustomBlock cb = getInstance(namespacedId);
ItemStack item = cb.getItemStack();
if (item != null) {
ItemMeta meta = item.getItemMeta();
meta.displayName(Component.text(cb.getDisplayName()));
item.setItemMeta(meta);
if (cb == null) {
return Optional.empty();
}
ItemStack item = cb.getItemStack();
ItemMeta meta = item.getItemMeta();
meta.displayName(Component.text(cb.getDisplayName()));
item.setItemMeta(meta);
return Optional.of(item);
}

Expand Down

0 comments on commit 6cb6a02

Please sign in to comment.