diff --git a/mozilla/content/xul/content/src/nsXULTreeElement.cpp b/mozilla/content/xul/content/src/nsXULTreeElement.cpp index 630c5349944..0f5918a2b06 100644 --- a/mozilla/content/xul/content/src/nsXULTreeElement.cpp +++ b/mozilla/content/xul/content/src/nsXULTreeElement.cpp @@ -345,6 +345,13 @@ nsXULTreeElement::FireOnSelectHandler() nsCOMPtr document; content->GetDocument(*getter_AddRefs(document)); + // If there's no document (e.g., a selection is occuring in a + // 'orphaned' node), then there ain't a whole lot to do here! + if (! document) { + NS_WARNING("FireOnSelectHandler occurred in orphaned node"); + return NS_OK; + } + // The frame code can suppress the firing of this handler by setting an attribute // for us. Look for that and bail if it's present. nsCOMPtr kSuppressSelectChange = dont_AddRef(NS_NewAtom("suppressonselect")); diff --git a/mozilla/rdf/content/src/nsXULTreeElement.cpp b/mozilla/rdf/content/src/nsXULTreeElement.cpp index 630c5349944..0f5918a2b06 100644 --- a/mozilla/rdf/content/src/nsXULTreeElement.cpp +++ b/mozilla/rdf/content/src/nsXULTreeElement.cpp @@ -345,6 +345,13 @@ nsXULTreeElement::FireOnSelectHandler() nsCOMPtr document; content->GetDocument(*getter_AddRefs(document)); + // If there's no document (e.g., a selection is occuring in a + // 'orphaned' node), then there ain't a whole lot to do here! + if (! document) { + NS_WARNING("FireOnSelectHandler occurred in orphaned node"); + return NS_OK; + } + // The frame code can suppress the firing of this handler by setting an attribute // for us. Look for that and bail if it's present. nsCOMPtr kSuppressSelectChange = dont_AddRef(NS_NewAtom("suppressonselect"));