diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index 2448c68c9c1..cfde4ef3836 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -1009,9 +1009,12 @@ DocumentViewerImpl::LoadComplete(nsresult aStatus) // Now that the document has loaded, we can tell the presshell // to unsuppress painting. if (mPresShell && !mStopped) { - nsCOMPtr shellDeathGrip(mPresShell); // bug 378682 + nsCOMPtr shellDeathGrip(mPresShell); mPresShell->UnsuppressPainting(); - mPresShell->ScrollToAnchor(); + // mPresShell could have been removed now, see bug 378682/421432 + if (mPresShell) { + mPresShell->ScrollToAnchor(); + } } nsJSContext::LoadEnd();