From 6575fbf571727ba5fff2aa07413a215fe0377e57 Mon Sep 17 00:00:00 2001 From: "Olli.Pettay@helsinki.fi" Date: Fri, 18 May 2007 03:23:45 -0700 Subject: [PATCH] Bug 380716, Crash [@ nsContentUtils::ContentIsDescendantOf], r+sr=jst --- content/base/src/nsGenericElement.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/content/base/src/nsGenericElement.cpp b/content/base/src/nsGenericElement.cpp index 63f638c2e83..753701f0c94 100644 --- a/content/base/src/nsGenericElement.cpp +++ b/content/base/src/nsGenericElement.cpp @@ -1904,13 +1904,17 @@ nsGenericElement::doPreHandleEvent(nsIContent* aContent, (aVisitor.mEvent->originalTarget == aContent && (aVisitor.mRelatedTargetIsInAnon = IsInAnonContent(relatedTarget)))) { nsIContent* nonAnon = FindFirstNonAnonContent(aContent); - nsIContent* nonAnonRelated = FindFirstNonAnonContent(relatedTarget); - if (nonAnon == nonAnonRelated || - nsContentUtils::ContentIsDescendantOf(nonAnonRelated, nonAnon)) { - aVisitor.mParentTarget = nsnull; - // Event should not propagate to non-anon content. - aVisitor.mCanHandle = isAnonForEvents; - return NS_OK; + if (nonAnon) { + nsIContent* nonAnonRelated = FindFirstNonAnonContent(relatedTarget); + if (nonAnonRelated) { + if (nonAnon == nonAnonRelated || + nsContentUtils::ContentIsDescendantOf(nonAnonRelated, nonAnon)) { + aVisitor.mParentTarget = nsnull; + // Event should not propagate to non-anon content. + aVisitor.mCanHandle = isAnonForEvents; + return NS_OK; + } + } } } }