Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
Fix review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin committed Mar 2, 2020
1 parent 7a367b1 commit 006c915
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@

Fixes possible crashes when using styles with line patterns.

- [android] Update toGeoJSON in android_conversion.hpp [#16243](https://github.com/mapbox/mapbox-gl-native/pull/16243)

Before this chage, `toGeoJSON` method in `android_conversion.hpp` can't convert Object(Map in android) to GeoJSON object.

But `within` expression need to accept an Object and then convert to GeoJSON object, now `toGeoJSON` method can convert both string and Object to GeoJSON.

## maps-v1.3.0 (2020.02-relvanillashake)

### 🐞 Bug fixes
Expand Down
16 changes: 12 additions & 4 deletions platform/android/src/style/android_conversion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,24 @@ class ConversionTraits<mbgl::android::Value> {
if (value.isNull()) {
error = { "no json data found" };
return {};
} else if (value.isString()) {
}

if (value.isString()) {
return parseGeoJSON(value.toString(), error);
} else if (value.isObject()) {
}

if (value.isObject()) {
mbgl::android::Value keys = value.keyArray();
std::size_t length = arrayLength(keys);
for (std::size_t i = 0; i < length; ++i) {
const auto k = keys.get(i).toString();
if (k == "json") {
auto v = value.get(k.c_str());
return parseGeoJSON(v.toString(), error);
auto v = value.get("json");
if (v.isString()) {
return parseGeoJSON(v.toString(), error);
} else {
break;
}
}
}
}
Expand Down

0 comments on commit 006c915

Please sign in to comment.