diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2017-10-17 09:10:50 -0700 |
---|---|---|
committer | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2017-10-25 22:32:26 +0300 |
commit | c9d7951e0d0ab85614ab296573e583ed44dbe7c0 (patch) | |
tree | 3a4d0ca32d2aba0c9e6f6c04e8b9282ebab47189 /src | |
parent | 1c78d14a2007720992305ac5170a0deced14e9d3 (diff) | |
download | qtlocation-mapboxgl-c9d7951e0d0ab85614ab296573e583ed44dbe7c0.tar.gz |
[core] fix crash when querying GeoJSON tiles
Diffstat (limited to 'src')
-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 d648d2e5ff..bbec899950 100644 --- a/src/mbgl/tile/geojson_tile.cpp +++ b/src/mbgl/tile/geojson_tile.cpp @@ -23,19 +23,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 tileData = getData()) { + if (auto layer = tileData->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)); } } } |