From bde34ee59a0b897fc1dd5f1591af0bf929e7af3c Mon Sep 17 00:00:00 2001 From: snowleo Date: Sat, 8 Oct 2011 19:41:41 +0200 Subject: Fix NPE in /repair --- .../src/com/earth2me/essentials/commands/Commandrepair.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java b/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java index 029901867..d6bcad464 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java @@ -30,6 +30,10 @@ public class Commandrepair extends EssentialsCommand if (args[0].equalsIgnoreCase("hand")) { final ItemStack item = user.getItemInHand(); + if (item == null) + { + throw new Exception(Util.i18n("repairInvalidType")); + } final String itemName = item.getType().toString().toLowerCase(); final Trade charge = new Trade("repair-" + itemName.replace('_', '-'), ess); @@ -84,6 +88,10 @@ public class Commandrepair extends EssentialsCommand { for (ItemStack item : items) { + if (item == null) + { + continue; + } final String itemName = item.getType().toString().toLowerCase(); final Trade charge = new Trade("repair-" + itemName.replace('_', '-'), ess); try -- cgit v1.2.3