diff options
author | kashike <[email protected]> | 2017-04-09 23:50:46 -0700 |
---|---|---|
committer | kashike <[email protected]> | 2017-04-09 23:52:14 -0700 |
commit | 19b5d5b124cd5cbb44019995c8c94706067d0f93 (patch) | |
tree | e4a5018d2aef72dc7c6e5fe8a5fec023186b1826 | |
parent | 6127ca1b6e01ebbc1825c3c169bac7d9cdcf5956 (diff) | |
download | Paper-19b5d5b124cd5cbb44019995c8c94706067d0f93.tar.gz Paper-19b5d5b124cd5cbb44019995c8c94706067d0f93.zip |
Fix NFE caused by attempting to read an EMPTY ItemStack
Thanks @gabizou
-rw-r--r-- | Spigot-Server-Patches/0214-Fix-NFE-when-attempting-to-read-EMPTY-ItemStack.patch | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Spigot-Server-Patches/0214-Fix-NFE-when-attempting-to-read-EMPTY-ItemStack.patch b/Spigot-Server-Patches/0214-Fix-NFE-when-attempting-to-read-EMPTY-ItemStack.patch new file mode 100644 index 0000000000..deb0eb80a1 --- /dev/null +++ b/Spigot-Server-Patches/0214-Fix-NFE-when-attempting-to-read-EMPTY-ItemStack.patch @@ -0,0 +1,23 @@ +From 01b5aef1aff1812344a999fbabba891c5f29b73f Mon Sep 17 00:00:00 2001 +From: kashike <[email protected]> +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 +@@ -97,7 +97,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.12.2 + |