Add null check for fireworks tag (Closes #636)

This commit is contained in:
RednedEpic 2020-05-24 13:20:19 -05:00
parent d918139c44
commit 6dabc22d22

View file

@ -36,10 +36,15 @@ public class FireworkTranslator extends NbtItemStackTranslator {
@Override
public void translateToBedrock(CompoundTag itemTag, ItemEntry itemEntry) {
CompoundTag fireworks = itemTag.get("Fireworks");
if (!itemTag.contains("Fireworks")) {
return;
}
CompoundTag fireworks = itemTag.get("Fireworks");
ListTag explosions = fireworks.get("Explosions");
if (explosions != null) {
if (explosions == null) {
return;
}
for (Tag effect : explosions.getValue()) {
CompoundTag effectData = (CompoundTag) effect;
@ -85,7 +90,6 @@ public class FireworkTranslator extends NbtItemStackTranslator {
explosions.add(newEffectData);
}
}
}
@Override
public void translateToJava(CompoundTag itemTag, ItemEntry itemEntry) {