3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 20:40:07 +01:00
Paper/Spigot-Server-Patches/0205-Fix-NFE-when-attempting-to-read-EMPTY-ItemStack.patch
2017-10-06 04:39:34 +01:00

24 Zeilen
1.1 KiB
Diff

From ecf214d5296e6e15188e49b0511d750fd4f6c433 Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc>
Date: Sun, 9 Apr 2017 23:50:15 -0700
Subject: [PATCH] Fix NFE when attempting to read EMPTY ItemStack
Thanks @gabizou
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index 3aefb023e..8c7f57bc7 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -103,7 +103,7 @@ public final class ItemStack {
// CraftBukkit - break into own method
public void load(NBTTagCompound nbttagcompound) {
- this.item = Item.b(nbttagcompound.getString("id"));
+ this.item = nbttagcompound.hasKeyOfType("id", 8) ? Item.b(nbttagcompound.getString("id")) : Item.getItemOf(Blocks.AIR); // Paper - fix NumberFormatException caused by attempting to read an EMPTY ItemStack
this.count = nbttagcompound.getByte("Count");
// CraftBukkit start - Route through setData for filtering
// this.damage = Math.max(0, nbttagcompound.getShort("Damage"));
--
2.14.2