From dc9a88629b4ba5f5564aec64971781d737e50946 Mon Sep 17 00:00:00 2001 From: "Thiago Marcos P. Santos" Date: Tue, 30 Jun 2015 15:39:41 +0300 Subject: [PATCH] Check if the style was loaded before rendering We now drive rendering from the main thread calling renderSync(), but if we do it just after we set the style URL it will assert because renderSync() expects the style to be fully loaded. --- src/mbgl/map/map_context.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/mbgl/map/map_context.cpp b/src/mbgl/map/map_context.cpp index 823bff54a..e1e57eac8 100644 --- a/src/mbgl/map/map_context.cpp +++ b/src/mbgl/map/map_context.cpp @@ -305,6 +305,11 @@ void MapContext::renderStill(const TransformState& state, StillImageCallback fn) bool MapContext::renderSync(const TransformState& state) { assert(util::ThreadContext::currentlyOn(util::ThreadType::Map)); + // Style was not loaded yet. + if (!style) { + return false; + } + transformState = state; // Cleanup OpenGL objects that we abandoned since the last render call. @@ -315,8 +320,6 @@ bool MapContext::renderSync(const TransformState& state) { return false; } - assert(style); - if (!painter) { painter = std::make_unique(); painter->setup();