diff --git a/content/canvas/src/nsCanvasRenderingContext2D.cpp b/content/canvas/src/nsCanvasRenderingContext2D.cpp index 51ed63c91e2..8281a80c946 100644 --- a/content/canvas/src/nsCanvasRenderingContext2D.cpp +++ b/content/canvas/src/nsCanvasRenderingContext2D.cpp @@ -852,7 +852,7 @@ nsCanvasRenderingContext2D::Reset() // only do this for non-docshell created contexts, // since those are the ones that we created a surface for - if (mValid && !mDocShell) + if (mValid && !mDocShell && mSurface) gCanvasMemoryUsed -= mWidth * mHeight * 4; mSurface = nsnull;