Gvas: fix some JSON!MASS fuckery.

To the community: I know VD didn't properly QA it, but please, be
careful with the system!
This commit is contained in:
Guillaume Jacquemin 2024-12-06 18:21:22 +01:00
parent 975c4c8664
commit 0da7de19fc
Signed by: williamjcm
SSH key fingerprint: SHA256:AYLOg+iTV0ElElnlu4vqM4edFazVdRiuQB0Y5LoKc4A

View file

@ -45,7 +45,17 @@ StringProperty::deserialise(Containers::StringView name, Containers::StringView
} }
} }
if(!reader.readUEString(prop->value)) { if(value_length == 4) {
// MASS files (the JSON-based sharing system VD made) have a bug that allows importing weapons of a type in
// another weapon array. It can lead to more serious issues, like weapon names being empty. The code below is an
// attempt to work around that particular issue.
LOG_WARNING_FORMAT("Property {} has an invalid value size {}. Working around it. Please do an action that leads to a write operation.", name, value_length);
value_length++;
prop->value = "";
std::uint32_t dummy_u32;
reader.readUint32(dummy_u32);
}
else if(!reader.readUEString(prop->value)) {
LOG_ERROR_FORMAT("Couldn't read string property {}'s value.", name); LOG_ERROR_FORMAT("Couldn't read string property {}'s value.", name);
return nullptr; return nullptr;
} }