1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-12-01 23:12:49 +02:00

Fixed silent errors on invalid Json references in schemas

This commit is contained in:
Ivan Savenko
2023-09-18 00:30:04 +03:00
parent 9c4475385b
commit 27b75dbbea
3 changed files with 28 additions and 7 deletions

View File

@@ -1279,9 +1279,19 @@ const JsonNode & JsonUtils::getSchema(const std::string & URI)
// check if json pointer if present (section after hash in string)
if(posHash == std::string::npos || posHash == URI.size() - 1)
return getSchemaByName(filename);
{
auto const & result = getSchemaByName(filename);
if (result.isNull())
logMod->error("Error: missing schema %s", URI);
return result;
}
else
return getSchemaByName(filename).resolvePointer(URI.substr(posHash + 1));
{
auto const & result = getSchemaByName(filename).resolvePointer(URI.substr(posHash + 1));
if (result.isNull())
logMod->error("Error: missing schema %s", URI);
return result;
}
}
void JsonUtils::merge(JsonNode & dest, JsonNode & source, bool ignoreOverride, bool copyMeta)