From 239b2828db3109661a5c9c6a192b217e7fa9339d Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Tue, 25 Dec 2018 09:27:17 +1100 Subject: [PATCH] SPIGOT-4551: Ignore invalid attribute modifier slots By: md_5 --- .../org/bukkit/craftbukkit/inventory/CraftMetaItem.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java index dc344be455..7784284a34 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -421,7 +421,13 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable { continue; } - EquipmentSlot slot = CraftEquipmentSlot.getSlot(EnumItemSlot.fromName(slotName.toLowerCase(Locale.ROOT))); + EquipmentSlot slot = null; + try { + slot = CraftEquipmentSlot.getSlot(EnumItemSlot.fromName(slotName.toLowerCase(Locale.ROOT))); + } catch (IllegalArgumentException ex) { + // SPIGOT-4551 - Slot is invalid, should really match nothing but this is undefined behaviour anyway + } + if (slot == null) { modifiers.put(attribute, attribMod); continue;