diff options
author | md_5 <git@md-5.net> | 2018-07-21 09:54:08 +1000 |
---|---|---|
committer | md_5 <git@md-5.net> | 2018-07-21 09:54:08 +1000 |
commit | 889e17f99d780d2eea783602b1a002d5c7fe9bbc (patch) | |
tree | ee983de6ecd65a2651621763e5ce69964443b04a /src/main | |
parent | 7c0f69e449b94547f95daa5c09407dd3f4a6fd52 (diff) | |
download | craftbukkit-889e17f99d780d2eea783602b1a002d5c7fe9bbc.tar craftbukkit-889e17f99d780d2eea783602b1a002d5c7fe9bbc.tar.gz craftbukkit-889e17f99d780d2eea783602b1a002d5c7fe9bbc.tar.lz craftbukkit-889e17f99d780d2eea783602b1a002d5c7fe9bbc.tar.xz craftbukkit-889e17f99d780d2eea783602b1a002d5c7fe9bbc.zip |
SPIGOT-4100: Ignore invalid item display names
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java index dfd6e66b..891e7c33 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -39,6 +39,7 @@ import com.google.common.base.Strings; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Sets; +import com.google.gson.JsonParseException; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -271,11 +272,19 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable { NBTTagCompound display = tag.getCompound(DISPLAY.NBT); if (display.hasKey(NAME.NBT)) { - displayName = IChatBaseComponent.ChatSerializer.a(display.getString(NAME.NBT)); + try { + displayName = IChatBaseComponent.ChatSerializer.a(display.getString(NAME.NBT)); + } catch (JsonParseException ex) { + // Ignore (stripped like Vanilla) + } } if (display.hasKey(LOCNAME.NBT)) { - locName = IChatBaseComponent.ChatSerializer.a(display.getString(LOCNAME.NBT)); + try { + locName = IChatBaseComponent.ChatSerializer.a(display.getString(LOCNAME.NBT)); + } catch (JsonParseException ex) { + // Ignore (stripped like Vanilla) + } } if (display.hasKey(LORE.NBT)) { |