2018-07-04 09:55:24 +02:00
|
|
|
From 070cf38a5cd2ad6ee121d9b8cefff5c0365e62cb Mon Sep 17 00:00:00 2001
|
2017-04-10 08:50:46 +02:00
|
|
|
From: kashike <kashike@vq.lc>
|
|
|
|
Date: Sun, 9 Apr 2017 23:50:15 -0700
|
2017-04-11 05:11:26 +02:00
|
|
|
Subject: [PATCH] Fix NFE when attempting to read EMPTY ItemStack
|
2017-04-10 08:50:46 +02:00
|
|
|
|
2017-04-11 05:11:26 +02:00
|
|
|
Thanks @gabizou
|
2017-04-10 08:50:46 +02:00
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
|
2018-06-29 06:55:29 +02:00
|
|
|
index 736686bed..d666088f2 100644
|
2017-04-10 08:50:46 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/ItemStack.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/ItemStack.java
|
2018-06-29 06:55:29 +02:00
|
|
|
@@ -120,7 +120,7 @@ public final class ItemStack {
|
2017-04-10 08:50:46 +02:00
|
|
|
|
|
|
|
// 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"));
|
|
|
|
--
|
2018-06-29 06:55:29 +02:00
|
|
|
2.18.0
|
2017-04-10 08:50:46 +02:00
|
|
|
|