diff options
-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)); } } } |