diff options
author | snowleo <schneeleo@gmail.com> | 2011-10-08 19:41:41 +0200 |
---|---|---|
committer | snowleo <schneeleo@gmail.com> | 2011-10-08 19:41:41 +0200 |
commit | 313df9988d1fd9312901d5cbdd609e406965d4ab (patch) | |
tree | 5a8bbde750a88c07f521847f182fe8d37d78a534 | |
parent | 06900e19f0bd774392f4f26fc6d0fd189eb1da4a (diff) | |
download | Essentials-313df9988d1fd9312901d5cbdd609e406965d4ab.tar Essentials-313df9988d1fd9312901d5cbdd609e406965d4ab.tar.gz Essentials-313df9988d1fd9312901d5cbdd609e406965d4ab.tar.lz Essentials-313df9988d1fd9312901d5cbdd609e406965d4ab.tar.xz Essentials-313df9988d1fd9312901d5cbdd609e406965d4ab.zip |
Fix NPE in /repair
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandrepair.java | 8 |
1 files changed, 8 insertions, 0 deletions
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 |