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:
@@ -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()) {
|
||||
|
||||
Reference in New Issue
Block a user