diff --git a/src/mbgl/map/map_context.cpp b/src/mbgl/map/map_context.cpp index a834f5065..47a6b3e4b 100644 --- a/src/mbgl/map/map_context.cpp +++ b/src/mbgl/map/map_context.cpp @@ -176,6 +176,11 @@ void MapContext::renderStill(StillImageCallback fn) { throw util::Exception("Map is currently rendering an image"); } + if (style->getLastError()) { + fn(style->getLastError(), nullptr); + return; + } + callback = fn; triggerUpdate(Update::RenderStill); } diff --git a/src/mbgl/style/style.cpp b/src/mbgl/style/style.cpp index 8999af3c7..30798e08e 100644 --- a/src/mbgl/style/style.cpp +++ b/src/mbgl/style/style.cpp @@ -203,6 +203,7 @@ void Style::emitResourceLoadingFailed(std::exception_ptr error) { try { if (error) { + lastError = error; std::rethrow_exception(error); } } catch(const std::exception& e) { diff --git a/src/mbgl/style/style.hpp b/src/mbgl/style/style.hpp index c70f019c4..a22067cb1 100644 --- a/src/mbgl/style/style.hpp +++ b/src/mbgl/style/style.hpp @@ -59,6 +59,10 @@ public: void setDefaultTransitionDuration(Duration); bool hasTransitions() const; + std::exception_ptr getLastError() const { + return lastError; + } + std::unique_ptr glyphStore; std::unique_ptr glyphAtlas; util::ptr sprite; @@ -90,6 +94,8 @@ private: Observer* observer = nullptr; + std::exception_ptr lastError; + std::string spriteURL; PropertyTransition defaultTransition; std::unique_ptr mtx;