diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 640cc3b1f0e9..3856a3393e7e 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -2498,6 +2498,9 @@ nsDocShell::SetFocus() is not collapsed. */ nsIFrame* rootFrame; presShell->GetRootFrame(&rootFrame); + if (!rootFrame) + return NS_ERROR_FAILURE; + nsRect frameRect; rootFrame->GetRect(frameRect); if (frameRect.IsEmpty()) {