From 2f1800fa2e48238336eec8af17d88256671b8c18 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Thu, 20 Jun 2024 07:04:11 +1000 Subject: [PATCH] SPIGOT-7789: Fix NPE in CraftMetaFirework applyToItem By: blablubbabc --- .../org/bukkit/craftbukkit/inventory/CraftMetaFirework.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java index 91a481d8e8..33c15a83d5 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java @@ -185,8 +185,10 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { } List effects = new ArrayList<>(); - for (FireworkEffect effect : this.effects) { - effects.add(getExplosion(effect)); + if (hasEffects()) { + for (FireworkEffect effect : this.effects) { + effects.add(getExplosion(effect)); + } } itemTag.put(FIREWORKS, new Fireworks(power, effects));