mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Fix crash on using JsonDeserializer on JsonNode without valid mod scope
This commit is contained in:
@@ -78,6 +78,7 @@ void JsonSerializer::serializeInternal(const std::string & fieldName, std::vecto
|
||||
void JsonSerializer::serializeInternal(std::string & value)
|
||||
{
|
||||
currentObject->String() = value;
|
||||
currentObject->setModScope(ModScope::scopeGame());
|
||||
}
|
||||
|
||||
void JsonSerializer::serializeInternal(int64_t & value)
|
||||
@@ -105,7 +106,10 @@ void JsonSerializer::serializeLIC(const std::string & fieldName, LICSet & value)
|
||||
void JsonSerializer::serializeString(const std::string & fieldName, std::string & value)
|
||||
{
|
||||
if(!value.empty())
|
||||
{
|
||||
currentObject->operator[](fieldName).String() = value;
|
||||
currentObject->operator[](fieldName).setModScope(ModScope::scopeGame());
|
||||
}
|
||||
}
|
||||
|
||||
void JsonSerializer::serializeRaw(const std::string & fieldName, JsonNode & value, const std::optional<std::reference_wrapper<const JsonNode>> defaultValue)
|
||||
|
||||
Reference in New Issue
Block a user