diff --git a/src/mbgl/annotation/render_annotation_source.cpp b/src/mbgl/annotation/render_annotation_source.cpp index 7d776f21c..d83f4d0fa 100644 --- a/src/mbgl/annotation/render_annotation_source.cpp +++ b/src/mbgl/annotation/render_annotation_source.cpp @@ -6,12 +6,15 @@ #include #include +#include + namespace mbgl { using namespace style; RenderAnnotationSource::RenderAnnotationSource(Immutable impl_) : RenderSource(impl_) { + assert(LayerManager::annotationsEnabled); tilePyramid.setObserver(this); } diff --git a/src/mbgl/renderer/render_source.cpp b/src/mbgl/renderer/render_source.cpp index d160eb16e..dfe1f25ed 100644 --- a/src/mbgl/renderer/render_source.cpp +++ b/src/mbgl/renderer/render_source.cpp @@ -10,6 +10,8 @@ #include #include +#include + namespace mbgl { using namespace style; @@ -28,7 +30,12 @@ std::unique_ptr RenderSource::create(Immutable impl) assert(false); return nullptr; case SourceType::Annotations: - return std::make_unique(staticImmutableCast(impl)); + if (LayerManager::annotationsEnabled) { + return std::make_unique(staticImmutableCast(impl)); + } else { + assert(false); + return nullptr; + } case SourceType::Image: return std::make_unique(staticImmutableCast(impl)); case SourceType::CustomVector: