diff --git a/xpfe/appshell/src/nsWebShellWindow.cpp b/xpfe/appshell/src/nsWebShellWindow.cpp index 89b09c55a647..c44bc034fb93 100644 --- a/xpfe/appshell/src/nsWebShellWindow.cpp +++ b/xpfe/appshell/src/nsWebShellWindow.cpp @@ -2176,7 +2176,7 @@ PRBool nsWebShellWindow::ExecuteCloseHandler() nsCOMPtr docViewer; nsCOMPtr presContext; docViewer = do_QueryInterface(contentViewer); - if (NS_SUCCEEDED(docViewer->GetPresContext(*getter_AddRefs(presContext)))) { + if (docViewer && NS_SUCCEEDED(docViewer->GetPresContext(*getter_AddRefs(presContext)))) { nsEventStatus status = nsEventStatus_eIgnore; nsMouseEvent event; event.eventStructType = NS_EVENT;