mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Fix for empty key/value when reading item string with wear but no metadata (#6058)
This commit is contained in:
parent
a08a93bc9c
commit
46ff2e2cef
1 changed files with 12 additions and 10 deletions
|
@ -28,16 +28,18 @@ void ItemStackMetadata::deSerialize(std::istream &is)
|
|||
|
||||
m_stringvars.clear();
|
||||
|
||||
if (!in.empty() && in[0] == DESERIALIZE_START) {
|
||||
Strfnd fnd(in);
|
||||
fnd.to(1);
|
||||
while (!fnd.at_end()) {
|
||||
std::string name = fnd.next(DESERIALIZE_KV_DELIM_STR);
|
||||
std::string var = fnd.next(DESERIALIZE_PAIR_DELIM_STR);
|
||||
m_stringvars[name] = var;
|
||||
if (!in.empty()) {
|
||||
if (in[0] == DESERIALIZE_START) {
|
||||
Strfnd fnd(in);
|
||||
fnd.to(1);
|
||||
while (!fnd.at_end()) {
|
||||
std::string name = fnd.next(DESERIALIZE_KV_DELIM_STR);
|
||||
std::string var = fnd.next(DESERIALIZE_PAIR_DELIM_STR);
|
||||
m_stringvars[name] = var;
|
||||
}
|
||||
} else {
|
||||
// BACKWARDS COMPATIBILITY
|
||||
m_stringvars[""] = in;
|
||||
}
|
||||
} else {
|
||||
// BACKWARDS COMPATIBILITY
|
||||
m_stringvars[""] = in;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue