[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 12:58:09 -08:00
parent f3294200c6
commit d4ed8d1a44
3 changed files with 18 additions and 0 deletions

View File

@@ -38,6 +38,9 @@ optional<Error> setPaintProperties(Layer& layer, const Convertible& value) {
if (!paintValue) {
return {};
}
if (!isObject(*paintValue)) {
return { { "paint must be an object" } };
}
return eachMember(*paintValue, [&] (const std::string& k, const Convertible& 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
}]
}