Skip to content

Commit

Permalink
Throw error if constructor of ItemWrapper is null, produces a weird e…
Browse files Browse the repository at this point in the history
…rror during runtime
  • Loading branch information
Burchard36 committed Dec 12, 2021
1 parent 9c7530a commit dbee5b9
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/main/java/com/burchard36/inventory/ItemWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public class ItemWrapper {
private final LegacyComponentSerializer serializer = LegacyComponentSerializer.builder().build();

public ItemWrapper(final ItemStack stack) {
if (stack == null) throw new IllegalArgumentException("ItemStack in ItemWrapper cannot be null!");
this.itemStack = stack;
if (stack.getType() != Material.AIR) this.itemMeta = this.itemStack.getItemMeta();
}
Expand Down

0 comments on commit dbee5b9

Please sign in to comment.