mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-09 00:22:08 -07:00
Prevent NPE when removing enchantment with no ItemMeta (#6459)
This commit is contained in:
@@ -183,6 +183,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
- }
|
- }
|
||||||
+ // Paper start - replace entire method
|
+ // Paper start - replace entire method
|
||||||
+ final ItemMeta itemMeta = this.getItemMeta();
|
+ final ItemMeta itemMeta = this.getItemMeta();
|
||||||
|
+ if (itemMeta == null) return 0;
|
||||||
+ int level = itemMeta.getEnchantLevel(ench);
|
+ int level = itemMeta.getEnchantLevel(ench);
|
||||||
+ if (level > 0) {
|
+ if (level > 0) {
|
||||||
+ itemMeta.removeEnchant(ench);
|
+ itemMeta.removeEnchant(ench);
|
||||||
|
Reference in New Issue
Block a user