[core] don't crash when the version number is not a number

This commit is contained in:
Konstantin Käfer
2016-07-20 13:22:09 +02:00
parent a07fbe8e34
commit 03ebae0f2e
3 changed files with 10 additions and 1 deletions

View File

@@ -35,7 +35,8 @@ void Parser::parse(const std::string& json) {
}
if (document.HasMember("version")) {
int version = document["version"].GetInt();
const JSValue& versionValue = document["version"];
const int version = versionValue.IsNumber() ? versionValue.GetInt() : 0;
if (version != 8) {
Log::Warning(Event::ParseStyle, "current renderer implementation only supports style spec version 8; using an outdated style will cause rendering errors");
}

View File

@@ -0,0 +1,7 @@
{
"default": {
"log": [
[1, "WARNING", "ParseStyle", "current renderer implementation only supports style spec version 8; using an outdated style will cause rendering errors"]
]
}
}

View File

@@ -0,0 +1 @@
{"version":"8"}