From: rubenwardy Date: Sat, 19 Aug 2017 18:43:02 +0000 (+0100) Subject: Fix empty legacy meta being persisted X-Git-Tag: 5.0.0~844 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=557bbc670451f82c384032383df80a1a92ffe724;p=oweals%2Fminetest.git Fix empty legacy meta being persisted --- diff --git a/src/itemstackmetadata.cpp b/src/itemstackmetadata.cpp index 02c548abb..f63671425 100644 --- a/src/itemstackmetadata.cpp +++ b/src/itemstackmetadata.cpp @@ -14,8 +14,9 @@ void ItemStackMetadata::serialize(std::ostream &os) const std::ostringstream os2; os2 << DESERIALIZE_START; for (const auto &stringvar : m_stringvars) { - os2 << stringvar.first << DESERIALIZE_KV_DELIM - << stringvar.second << DESERIALIZE_PAIR_DELIM; + if (!stringvar.first.empty() || !stringvar.second.empty()) + os2 << stringvar.first << DESERIALIZE_KV_DELIM + << stringvar.second << DESERIALIZE_PAIR_DELIM; } os << serializeJsonStringIfNeeded(os2.str()); }