From dfdbb96740fc62d4f7c72763ca58a16a83bba282 Mon Sep 17 00:00:00 2001 From: "bryner%uiuc.edu" Date: Fri, 23 Jun 2000 01:54:20 +0000 Subject: [PATCH] Bulletproofing fix for bug 41116. r=saari. git-svn-id: svn://10.0.0.236/trunk@73011 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/events/src/nsEventStateManager.cpp | 14 ++++++++------ mozilla/layout/events/src/nsEventStateManager.cpp | 14 ++++++++------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/mozilla/content/events/src/nsEventStateManager.cpp b/mozilla/content/events/src/nsEventStateManager.cpp index b721bc23fa1..c3235887215 100644 --- a/mozilla/content/events/src/nsEventStateManager.cpp +++ b/mozilla/content/events/src/nsEventStateManager.cpp @@ -469,12 +469,14 @@ nsEventStateManager::PreHandleEvent(nsIPresContext* aPresContext, nsCOMPtr domDoc; nsCOMPtr document; focusedWindow->GetDocument(getter_AddRefs(domDoc)); - document = do_QueryInterface(domDoc); - nsCOMPtr shell; - nsCOMPtr context; - shell = getter_AddRefs(document->GetShellAt(0)); - shell->GetPresContext(getter_AddRefs(context)); - focusContent->SetFocus(context); + if (domDoc) { + document = do_QueryInterface(domDoc); + nsCOMPtr shell; + nsCOMPtr context; + shell = getter_AddRefs(document->GetShellAt(0)); + shell->GetPresContext(getter_AddRefs(context)); + focusContent->SetFocus(context); + } } if (commandDispatcher) { diff --git a/mozilla/layout/events/src/nsEventStateManager.cpp b/mozilla/layout/events/src/nsEventStateManager.cpp index b721bc23fa1..c3235887215 100644 --- a/mozilla/layout/events/src/nsEventStateManager.cpp +++ b/mozilla/layout/events/src/nsEventStateManager.cpp @@ -469,12 +469,14 @@ nsEventStateManager::PreHandleEvent(nsIPresContext* aPresContext, nsCOMPtr domDoc; nsCOMPtr document; focusedWindow->GetDocument(getter_AddRefs(domDoc)); - document = do_QueryInterface(domDoc); - nsCOMPtr shell; - nsCOMPtr context; - shell = getter_AddRefs(document->GetShellAt(0)); - shell->GetPresContext(getter_AddRefs(context)); - focusContent->SetFocus(context); + if (domDoc) { + document = do_QueryInterface(domDoc); + nsCOMPtr shell; + nsCOMPtr context; + shell = getter_AddRefs(document->GetShellAt(0)); + shell->GetPresContext(getter_AddRefs(context)); + focusContent->SetFocus(context); + } } if (commandDispatcher) {