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:
Thiago Marcos P. Santos
2015-06-30 15:39:41 +03:00
parent 923ea1456a
commit dc9a88629b

View File

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