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.
This commit is contained in:
@@ -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>();
|
||||
painter->setup();
|
||||
|
||||
Reference in New Issue
Block a user