From 1e381a59be1d81fa75bddab5c1159f2cb5b8e589 Mon Sep 17 00:00:00 2001 From: md678685 Date: Sat, 13 Oct 2018 16:32:21 +0100 Subject: [PATCH] Throw meaningful exception when item not found --- Essentials/src/com/earth2me/essentials/ItemDb.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Essentials/src/com/earth2me/essentials/ItemDb.java b/Essentials/src/com/earth2me/essentials/ItemDb.java index 616ef4ca5..d2d52abb2 100644 --- a/Essentials/src/com/earth2me/essentials/ItemDb.java +++ b/Essentials/src/com/earth2me/essentials/ItemDb.java @@ -101,7 +101,12 @@ public class ItemDb implements IConf, net.ess3.api.IItemDb { @Override public ItemStack get(final String id) throws Exception { - ItemData data = Objects.requireNonNull(getByName(id)); + ItemData data = getByName(id); + + if (data == null) { + throw new Exception(tl("unknownItemName", id)); + } + PotionData potionData = data.getPotionData(); Material material = data.getMaterial();