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.
This commit is contained in:
Thiago Marcos P. Santos
2015-07-10 20:25:21 +03:00
parent d63f706c5f
commit 8a9665b085

View File

@@ -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()) {