diff options
author | Thiago Marcos P. Santos <thiago@mapbox.com> | 2015-07-10 20:25:21 +0300 |
---|---|---|
committer | Thiago Marcos P. Santos <thiago@mapbox.com> | 2015-07-10 20:25:49 +0300 |
commit | 8a9665b08546408dabc4a0a59102039fda58a503 (patch) | |
tree | d03cde2db5da6f05373dc1a351c084de7dc8d9f4 /src | |
parent | d63f706c5fcf1c79cf37b8745fbee9191face13f (diff) | |
download | qtlocation-mapboxgl-8a9665b08546408dabc4a0a59102039fda58a503.tar.gz |
Deffer updateAnnotationTiles() if Source is not available
The Style object might have been created but the Source is not
yet available because the JSON file was not set. Can happen
specially when the style is loaded from the network.
Diffstat (limited to 'src')
-rw-r--r-- | src/mbgl/map/map_context.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/mbgl/map/map_context.cpp b/src/mbgl/map/map_context.cpp index aff323d3f6..4447ecc4f0 100644 --- a/src/mbgl/map/map_context.cpp +++ b/src/mbgl/map/map_context.cpp @@ -150,11 +150,20 @@ void MapContext::updateAnnotationTiles(const std::unordered_set<TileID, TileID:: util::exclusive<AnnotationManager> annotationManager = data.getAnnotationManager(); annotationManager->markStaleTiles(ids); - if (!style) return; + if (!style) { + return; + } // grab existing, single shape annotations source const auto& shapeID = AnnotationManager::ShapeLayerID; - style->getSource(shapeID)->enabled = true; + Source* shapeAnnotationSource = style->getSource(shapeID); + + // Style not parsed yet + if (!shapeAnnotationSource) { + return; + } + + shapeAnnotationSource->enabled = true; // create (if necessary) layers and buckets for each shape for (const auto &shapeAnnotationID : annotationManager->getOrderedShapeAnnotations()) { |