From af6e7e67ecd5a284a309c91d07c7deed4fa15437 Mon Sep 17 00:00:00 2001 From: Silent Date: Sun, 15 Nov 2020 15:34:11 +0100 Subject: [PATCH] Fix error when provided an invalid id --- src/main/java/tsp/headdb/command/Command_headdb.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/tsp/headdb/command/Command_headdb.java b/src/main/java/tsp/headdb/command/Command_headdb.java index f5ec943..9bb712f 100644 --- a/src/main/java/tsp/headdb/command/Command_headdb.java +++ b/src/main/java/tsp/headdb/command/Command_headdb.java @@ -87,11 +87,11 @@ public class Command_headdb implements CommandExecutor { } Head head = HeadAPI.getHeadByID(id); - ItemStack item = head.getItemStack(); - if (item == null) { + if (head == null) { Utils.sendMessage(sender, "&cCould not find head with id &e" + id); return true; } + ItemStack item = head.getItemStack(); item.setAmount(amount); target.getInventory().addItem(item); Utils.sendMessage(sender, "Given &c" + target.getName() + " &ex" + amount + " " + head.getName());