summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2018-07-19 11:34:19 +1000
committermd_5 <git@md-5.net>2018-07-19 11:34:19 +1000
commit2b93d839ddb1541cad937e3dd7a4da5d1525af3d (patch)
tree5789a5a2565d4e7cbdc20bbeb93199e8a1e1b3d3
parentb9f16157780e473ee5674acfab75474193d02610 (diff)
downloadcraftbukkit-2b93d839ddb1541cad937e3dd7a4da5d1525af3d.tar
craftbukkit-2b93d839ddb1541cad937e3dd7a4da5d1525af3d.tar.gz
craftbukkit-2b93d839ddb1541cad937e3dd7a4da5d1525af3d.tar.lz
craftbukkit-2b93d839ddb1541cad937e3dd7a4da5d1525af3d.tar.xz
craftbukkit-2b93d839ddb1541cad937e3dd7a4da5d1525af3d.zip
SPIGOT-4047: Ignore non-existent potions
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java
index 4fec1676..1080e52c 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java
@@ -71,6 +71,11 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
for (int i = 0; i < length; i++) {
NBTTagCompound effect = list.get(i);
PotionEffectType type = PotionEffectType.getById(effect.getByte(ID.NBT));
+ // SPIGOT-4047: Vanilla just disregards these
+ if (type == null) {
+ continue;
+ }
+
int amp = effect.getByte(AMPLIFIER.NBT);
int duration = effect.getInt(DURATION.NBT);
boolean ambient = effect.getBoolean(AMBIENT.NBT);