diff options
author | Thiago Marcos P. Santos <thiago@mapbox.com> | 2016-08-25 12:50:05 +0300 |
---|---|---|
committer | Thiago Marcos P. Santos <thiago@mapbox.com> | 2016-08-25 22:05:00 +0300 |
commit | a12fa9333b9d58ffa38bf09d76bc2cca60a867e1 (patch) | |
tree | c5ce2276fa3ae1dc41c4575333c5aae9ce268562 /platform | |
parent | d0a0b2ef7e4af9129183ac31d46d600f196ccaf2 (diff) | |
download | qtlocation-mapboxgl-a12fa9333b9d58ffa38bf09d76bc2cca60a867e1.tar.gz |
[node] Throw on invalid style JSON
Fixes #6143
Diffstat (limited to 'platform')
-rw-r--r-- | platform/node/src/node_map.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/platform/node/src/node_map.cpp b/platform/node/src/node_map.cpp index 3eb9d8e539..f737ddfd86 100644 --- a/platform/node/src/node_map.cpp +++ b/platform/node/src/node_map.cpp @@ -740,6 +740,12 @@ NodeMap::NodeMap(v8::Local<v8::Object> options) : map(std::make_unique<mbgl::Map>(view, *this, mbgl::MapMode::Still)), async(new uv_async_t) { + view.setMapChangeCallback([&](mbgl::MapChange change) { + if (change == mbgl::MapChangeDidFailLoadingMap) { + throw std::runtime_error("Requires a map style to be a valid style JSON"); + } + }); + async->data = this; uv_async_init(uv_default_loop(), async, [](UV_ASYNC_PARAMS(h)) { reinterpret_cast<NodeMap *>(h->data)->renderFinished(); |