summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage/FireworksSerializer.cpp
diff options
context:
space:
mode:
authorTycho <work.tycho+git@gmail.com>2014-03-19 20:13:05 +0100
committerTycho <work.tycho+git@gmail.com>2014-03-19 20:13:05 +0100
commit1635c696de75e17adaeee65531fa9b864542cca8 (patch)
treefbea00253179bfb2e11d5a8899071cbc191091ab /src/WorldStorage/FireworksSerializer.cpp
parentAdded unreachable lines backit prtected by preprocessor guards (diff)
parentAPIDump: Reformatted the plugin to avoid all ZBS Analyzer issues. (diff)
downloadcuberite-1635c696de75e17adaeee65531fa9b864542cca8.tar
cuberite-1635c696de75e17adaeee65531fa9b864542cca8.tar.gz
cuberite-1635c696de75e17adaeee65531fa9b864542cca8.tar.bz2
cuberite-1635c696de75e17adaeee65531fa9b864542cca8.tar.lz
cuberite-1635c696de75e17adaeee65531fa9b864542cca8.tar.xz
cuberite-1635c696de75e17adaeee65531fa9b864542cca8.tar.zst
cuberite-1635c696de75e17adaeee65531fa9b864542cca8.zip
Diffstat (limited to 'src/WorldStorage/FireworksSerializer.cpp')
-rw-r--r--src/WorldStorage/FireworksSerializer.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/WorldStorage/FireworksSerializer.cpp b/src/WorldStorage/FireworksSerializer.cpp
index 3c97ae0a2..744fc731f 100644
--- a/src/WorldStorage/FireworksSerializer.cpp
+++ b/src/WorldStorage/FireworksSerializer.cpp
@@ -20,8 +20,14 @@ void cFireworkItem::WriteToNBTCompound(const cFireworkItem & a_FireworkItem, cFa
a_Writer.AddByte("Flicker", a_FireworkItem.m_HasFlicker);
a_Writer.AddByte("Trail", a_FireworkItem.m_HasTrail);
a_Writer.AddByte("Type", a_FireworkItem.m_Type);
- a_Writer.AddIntArray("Colors", &(a_FireworkItem.m_Colours[0]), a_FireworkItem.m_Colours.size());
- a_Writer.AddIntArray("FadeColors", &(a_FireworkItem.m_FadeColours[0]), a_FireworkItem.m_FadeColours.size());
+ if (!a_FireworkItem.m_Colours.empty())
+ {
+ a_Writer.AddIntArray("Colors", &(a_FireworkItem.m_Colours[0]), a_FireworkItem.m_Colours.size());
+ }
+ if (!a_FireworkItem.m_FadeColours.empty())
+ {
+ a_Writer.AddIntArray("FadeColors", &(a_FireworkItem.m_FadeColours[0]), a_FireworkItem.m_FadeColours.size());
+ }
a_Writer.EndCompound();
a_Writer.EndList();
a_Writer.EndCompound();