diff options
author | danesfeder <dan.nesfeder@mapbox.com> | 2017-10-17 10:24:18 -0700 |
---|---|---|
committer | danesfeder <dan.nesfeder@mapbox.com> | 2017-10-17 10:24:18 -0700 |
commit | aa24540c2f453a3d47bf3518e20c78c5666dab04 (patch) | |
tree | 0f9351ad8c869e89d1a6b265a363c0b731949f1a | |
parent | 6a0c8ee7554c61e5b7709eaeb9522c37122d40be (diff) | |
download | qtlocation-mapboxgl-aa24540c2f453a3d47bf3518e20c78c5666dab04.tar.gz |
fix crash when querying GeoJSON tilesupstream/dan-nav-debug
-rw-r--r-- | src/mbgl/tile/geojson_tile.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/mbgl/tile/geojson_tile.cpp b/src/mbgl/tile/geojson_tile.cpp index ee4989462c..728eb80e8a 100644 --- a/src/mbgl/tile/geojson_tile.cpp +++ b/src/mbgl/tile/geojson_tile.cpp @@ -25,19 +25,19 @@ void GeoJSONTile::querySourceFeatures( const SourceQueryOptions& options) { // Ignore the sourceLayer, there is only one - auto layer = getData()->getLayer({}); - - if (layer) { - auto featureCount = layer->featureCount(); - for (std::size_t i = 0; i < featureCount; i++) { - auto feature = layer->getFeature(i); - - // Apply filter, if any - if (options.filter && !(*options.filter)(*feature)) { - continue; + if (auto data = getData()) { + if (auto layer = getData()->getLayer({})) { + auto featureCount = layer->featureCount(); + for (std::size_t i = 0; i < featureCount; i++) { + auto feature = layer->getFeature(i); + + // Apply filter, if any + if (options.filter && !(*options.filter)(*feature)) { + continue; + } + + result.push_back(convertFeature(*feature, id.canonical)); } - - result.push_back(convertFeature(*feature, id.canonical)); } } } |