From 52ee5f4843187f1aeef859384efd2b0a3493022f Mon Sep 17 00:00:00 2001 From: MrPowerGamerBR Date: Sun, 25 Aug 2024 18:05:48 -0300 Subject: [PATCH] Check if the item has item meta and, if it doesn't, bail out --- .../com/gmail/nossr50/config/skills/alchemy/PotionConfig.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/gmail/nossr50/config/skills/alchemy/PotionConfig.java b/src/main/java/com/gmail/nossr50/config/skills/alchemy/PotionConfig.java index 8281d6f3c..7d1ff04e0 100644 --- a/src/main/java/com/gmail/nossr50/config/skills/alchemy/PotionConfig.java +++ b/src/main/java/com/gmail/nossr50/config/skills/alchemy/PotionConfig.java @@ -335,6 +335,10 @@ public class PotionConfig extends LegacyConfigLoader { * @return AlchemyPotion that corresponds to the given ItemStack. */ public AlchemyPotion getPotion(ItemStack item) { + // Fast return if the item does not have any item meta to avoid initializing an unnecessary ItemMeta instance + if (!item.hasItemMeta()) + return null; + ItemMeta itemMeta = item.getItemMeta(); final List potionList = alchemyPotions.values() .stream()