summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2017-10-17 09:10:50 -0700
committerBruno de Oliveira Abinader <bruno@mapbox.com>2017-10-25 22:32:26 +0300
commitc9d7951e0d0ab85614ab296573e583ed44dbe7c0 (patch)
tree3a4d0ca32d2aba0c9e6f6c04e8b9282ebab47189 /src
parent1c78d14a2007720992305ac5170a0deced14e9d3 (diff)
downloadqtlocation-mapboxgl-c9d7951e0d0ab85614ab296573e583ed44dbe7c0.tar.gz
[core] fix crash when querying GeoJSON tiles
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/tile/geojson_tile.cpp24
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));
}
}
}