summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-03-17 22:12:02 +0100
committermadmaxoft <github@xoft.cz>2014-03-17 22:12:02 +0100
commit9447cd20f3bff89d87bda07320c5ccbb45aa7556 (patch)
tree13bcfe7212a9d64bf8f103a7ae7323282d651964 /src/WorldStorage
parentFixed double to float conversions. (diff)
downloadcuberite-9447cd20f3bff89d87bda07320c5ccbb45aa7556.tar
cuberite-9447cd20f3bff89d87bda07320c5ccbb45aa7556.tar.gz
cuberite-9447cd20f3bff89d87bda07320c5ccbb45aa7556.tar.bz2
cuberite-9447cd20f3bff89d87bda07320c5ccbb45aa7556.tar.lz
cuberite-9447cd20f3bff89d87bda07320c5ccbb45aa7556.tar.xz
cuberite-9447cd20f3bff89d87bda07320c5ccbb45aa7556.tar.zst
cuberite-9447cd20f3bff89d87bda07320c5ccbb45aa7556.zip
Diffstat (limited to 'src/WorldStorage')
-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();