From 965f78b3af407693fd9f3242d9ffd2f7ff1d1c80 Mon Sep 17 00:00:00 2001 From: Riley Park Date: Sun, 9 Apr 2017 23:50:46 -0700 Subject: [PATCH] Fix NFE caused by attempting to read an EMPTY ItemStack Thanks @gabizou --- ...n-attempting-to-read-EMPTY-ItemStack.patch | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Spigot-Server-Patches/Fix-NFE-when-attempting-to-read-EMPTY-ItemStack.patch diff --git a/Spigot-Server-Patches/Fix-NFE-when-attempting-to-read-EMPTY-ItemStack.patch b/Spigot-Server-Patches/Fix-NFE-when-attempting-to-read-EMPTY-ItemStack.patch new file mode 100644 index 0000000000..7f7e4dff32 --- /dev/null +++ b/Spigot-Server-Patches/Fix-NFE-when-attempting-to-read-EMPTY-ItemStack.patch @@ -0,0 +1,21 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Riley Park +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 45ebd3f6..cf204f41 100644 +--- a/src/main/java/net/minecraft/server/ItemStack.java ++++ b/src/main/java/net/minecraft/server/ItemStack.java +@@ -0,0 +0,0 @@ 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")); +-- \ No newline at end of file