[core] fix crash when the style JSON doesn't have an object at its root

This commit is contained in:
Konstantin Käfer
2016-07-20 13:16:49 +02:00
parent 000539af82
commit a07fbe8e34
3 changed files with 13 additions and 0 deletions

View File

@@ -29,6 +29,11 @@ void Parser::parse(const std::string& json) {
return;
}
if (!document.IsObject()) {
Log::Error(Event::ParseStyle, "Style JSON must be an object");
return;
}
if (document.HasMember("version")) {
int version = document["version"].GetInt();
if (version != 8) {

View File

@@ -0,0 +1,7 @@
{
"default": {
"log": [
[1, "ERROR", "ParseStyle", "Style JSON must be an object"]
]
}
}

View File

@@ -0,0 +1 @@
""