aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubenwardy <rubenwardy@gmail.com>2017-08-19 19:43:02 +0100
committerparamat <mat.gregory@virginmedia.com>2017-09-10 01:30:42 +0100
commit557bbc670451f82c384032383df80a1a92ffe724 (patch)
tree3abcc1163a3242b2da1facc3edba0462b746338b /src
parentfaad6479defa30dec10cf4394c1da6fdf8f12f19 (diff)
downloadminetest-557bbc670451f82c384032383df80a1a92ffe724.tar.gz
minetest-557bbc670451f82c384032383df80a1a92ffe724.tar.bz2
minetest-557bbc670451f82c384032383df80a1a92ffe724.zip
Fix empty legacy meta being persisted
Diffstat (limited to 'src')
-rw-r--r--src/itemstackmetadata.cpp5
1 files changed, 3 insertions, 2 deletions
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());
}