summaryrefslogtreecommitdiff
path: root/src/mbgl/tile
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-26 14:30:39 +0300
commitab3547a21614605f8acef606226b33c874b4c2dd (patch)
treef913b4d832123fbc56287fa1eabf840de5971160 /src/mbgl/tile
parent45dc313009de80da3b4ba988b133c69b6057bec1 (diff)
downloadqtlocation-mapboxgl-ab3547a21614605f8acef606226b33c874b4c2dd.tar.gz
[core] fix crash when querying GeoJSON tiles
Diffstat (limited to 'src/mbgl/tile')
-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));
}
}
}