[core] fix style parsing crash when a layer's paint property is not an object

This commit is contained in:
Konstantin Käfer
2018-01-23 13:03:57 -08:00
parent 14f3f86f63
commit 3f7c30f9d3
3 changed files with 18 additions and 0 deletions

View File

@@ -43,6 +43,9 @@ optional<Error> setPaintProperties(Layer& layer, const V& value) {
if (!paintValue) {
return {};
}
if (!isObject(*paintValue)) {
return { { "paint must be an object" } };
}
return eachMember(*paintValue, [&] (const std::string& k, const V& v) {
return setPaintProperty(layer, k, v);
});

View File

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

View File

@@ -0,0 +1,8 @@
{
"version": 8,
"layers": [{
"id": "background",
"type": "background",
"paint": true
}]
}