Add check-for-null-pointer to FireOnSelectHandler() to avoid crashing in the case where a select handler fires on an 'orphaned' node with no document. This can happen if a document is being destroyed and random scripts and events are still filtering through the system.

git-svn-id: svn://10.0.0.236/trunk@50585 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
waterson%netscape.com 1999-10-13 08:02:02 +00:00
parent 3cadc697e1
commit 250dbce4cf
2 changed files with 14 additions and 0 deletions

View File

@ -345,6 +345,13 @@ nsXULTreeElement::FireOnSelectHandler()
nsCOMPtr<nsIDocument> 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<nsIAtom> kSuppressSelectChange = dont_AddRef(NS_NewAtom("suppressonselect"));

View File

@ -345,6 +345,13 @@ nsXULTreeElement::FireOnSelectHandler()
nsCOMPtr<nsIDocument> 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<nsIAtom> kSuppressSelectChange = dont_AddRef(NS_NewAtom("suppressonselect"));