Fix a couple of ItemMeta related NPEs (#11149)

This commit is contained in:
Lulu13022002
2024-07-23 10:11:00 +02:00
parent 0139f28d62
commit 61ad933f4d
2 changed files with 14 additions and 8 deletions

View File

@@ -71,6 +71,16 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
@@ -0,0 +0,0 @@ public final class CraftItemStack extends ItemStack {
@Override
public void removeEnchantments() {
+ if (this.handle != null) { // Paper - fix NPE
this.handle.remove(DataComponents.ENCHANTMENTS);
+ } // Paper
}
@Override
@@ -0,0 +0,0 @@ public final class CraftItemStack extends ItemStack {
// Paper end - improve handled tags on type change
// Paper start