From b9871610d1c9c1ae9f2a41a43bda0c61ff62923a Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Sun, 22 Aug 2021 08:13:51 -0700 Subject: [PATCH] Prevent NPE when removing enchantment with no ItemMeta (#6459) --- patches/server/Handle-Item-Meta-Inconsistencies.patch | 1 + 1 file changed, 1 insertion(+) diff --git a/patches/server/Handle-Item-Meta-Inconsistencies.patch b/patches/server/Handle-Item-Meta-Inconsistencies.patch index 6bee1768c0..d15c588c31 100644 --- a/patches/server/Handle-Item-Meta-Inconsistencies.patch +++ b/patches/server/Handle-Item-Meta-Inconsistencies.patch @@ -183,6 +183,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - } + // Paper start - replace entire method + final ItemMeta itemMeta = this.getItemMeta(); ++ if (itemMeta == null) return 0; + int level = itemMeta.getEnchantLevel(ench); + if (level > 0) { + itemMeta.removeEnchant(ench);