From 9cea6738a55752d24c0c744cde26f966250511a8 Mon Sep 17 00:00:00 2001 From: "sspitzer%netscape.com" Date: Sat, 29 May 1999 20:55:48 +0000 Subject: [PATCH] fix for #7344. check for nsnull before dereferencing. --- content/base/src/nsDocument.cpp | 8 +++++--- layout/base/src/nsDocument.cpp | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index c8e54abcf08..99a47c13a15 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -2268,9 +2268,11 @@ nsresult nsDocument::HandleDOMEvent(nsIPresContext& aPresContext, //Capturing stage if (NS_EVENT_FLAG_BUBBLE != aFlags) { nsIScriptGlobalObject* mGlobal; - if (NS_OK == mScriptContextOwner->GetScriptGlobalObject(&mGlobal)) { - mGlobal->HandleDOMEvent(aPresContext, aEvent, aDOMEvent, NS_EVENT_FLAG_CAPTURE, aEventStatus); - NS_RELEASE(mGlobal); + if (mScriptContextOwner != nsnull) { + if (NS_OK == mScriptContextOwner->GetScriptGlobalObject(&mGlobal)) { + mGlobal->HandleDOMEvent(aPresContext, aEvent, aDOMEvent, NS_EVENT_FLAG_CAPTURE, aEventStatus); + NS_RELEASE(mGlobal); + } } } diff --git a/layout/base/src/nsDocument.cpp b/layout/base/src/nsDocument.cpp index c8e54abcf08..99a47c13a15 100644 --- a/layout/base/src/nsDocument.cpp +++ b/layout/base/src/nsDocument.cpp @@ -2268,9 +2268,11 @@ nsresult nsDocument::HandleDOMEvent(nsIPresContext& aPresContext, //Capturing stage if (NS_EVENT_FLAG_BUBBLE != aFlags) { nsIScriptGlobalObject* mGlobal; - if (NS_OK == mScriptContextOwner->GetScriptGlobalObject(&mGlobal)) { - mGlobal->HandleDOMEvent(aPresContext, aEvent, aDOMEvent, NS_EVENT_FLAG_CAPTURE, aEventStatus); - NS_RELEASE(mGlobal); + if (mScriptContextOwner != nsnull) { + if (NS_OK == mScriptContextOwner->GetScriptGlobalObject(&mGlobal)) { + mGlobal->HandleDOMEvent(aPresContext, aEvent, aDOMEvent, NS_EVENT_FLAG_CAPTURE, aEventStatus); + NS_RELEASE(mGlobal); + } } }