Merge "Don't try to draw if there's no canvas or surface"
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index fc3548c..97baba8 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -349,6 +349,8 @@
mDirtyRegionsEnabled = mGlobalContext->enableDirtyRegions(mEglSurface);
mHaveNewSurface = true;
makeCurrent();
+ } else {
+ mRenderThread.removeFrameCallback(this);
}
}
@@ -468,6 +470,10 @@
// Called by choreographer to do an RT-driven animation
void CanvasContext::doFrame() {
+ if (CC_UNLIKELY(!mCanvas || mEglSurface == EGL_NO_SURFACE)) {
+ return;
+ }
+
ATRACE_CALL();
TreeInfo info;