From e0a5449d5dfd0314a0118ba6e6b648f0249ea19d Mon Sep 17 00:00:00 2001 From: "rginda%netscape.com" Date: Mon, 18 Mar 2002 23:39:48 +0000 Subject: [PATCH] bug 130894, add null checks to avoid crashes found by js debugger users. r=caillon@returnzero.com, sr=ben, a=asa git-svn-id: svn://10.0.0.236/trunk@116801 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/xul/base/src/nsMenuFrame.cpp | 6 ++++++ mozilla/layout/xul/base/src/nsXULTooltipListener.cpp | 2 ++ 2 files changed, 8 insertions(+) diff --git a/mozilla/layout/xul/base/src/nsMenuFrame.cpp b/mozilla/layout/xul/base/src/nsMenuFrame.cpp index 3f272a7c8b4..8fb12f9d430 100644 --- a/mozilla/layout/xul/base/src/nsMenuFrame.cpp +++ b/mozilla/layout/xul/base/src/nsMenuFrame.cpp @@ -918,6 +918,12 @@ nsMenuFrame::OpenMenuInternal(PRBool aActivateFlag) void nsMenuFrame::GetMenuChildrenElement(nsIContent** aResult) { + if (!mContent) + { + *aResult = nsnull; + return; + } + nsresult rv; nsCOMPtr xblService = do_GetService("@mozilla.org/xbl;1", &rv); diff --git a/mozilla/layout/xul/base/src/nsXULTooltipListener.cpp b/mozilla/layout/xul/base/src/nsXULTooltipListener.cpp index 6a2bdad49bb..876d7c39c6e 100644 --- a/mozilla/layout/xul/base/src/nsXULTooltipListener.cpp +++ b/mozilla/layout/xul/base/src/nsXULTooltipListener.cpp @@ -391,6 +391,8 @@ nsXULTooltipListener::ShowTooltip() // the tooltip. If there is an attribute on the popup telling us // not to create the auto-hide timer, don't. nsCOMPtr tooltipEl(do_QueryInterface(mCurrentTooltip)); + if (!tooltipEl) + return NS_ERROR_FAILURE; nsAutoString noAutoHide; tooltipEl->GetAttribute(NS_LITERAL_STRING("noautohide"), noAutoHide); if (noAutoHide != NS_LITERAL_STRING("true"))