diff --git a/content/xul/content/src/nsXULElement.cpp b/content/xul/content/src/nsXULElement.cpp index 7967c6b7bb81..66a7c4cf1b55 100644 --- a/content/xul/content/src/nsXULElement.cpp +++ b/content/xul/content/src/nsXULElement.cpp @@ -22,7 +22,7 @@ * Pierre Phaneuf * Peter Annema * Brendan Eich - * + * Mike Shaver * * This Original Code has been modified by IBM Corporation. * Modifications made by IBM described herein are @@ -4890,6 +4890,10 @@ nsXULElement::IsAncestor(nsIDOMNode* aParentNode, nsIDOMNode* aChildNode) NS_IMETHODIMP nsXULElement::Focus() { + // What kind of crazy tries to focus an element without a doc? + if (!mDocument) + return NS_OK; + // Obtain a presentation context and then call SetFocus. PRInt32 count = mDocument->GetNumberOfShells(); if (count == 0) @@ -4909,6 +4913,10 @@ nsXULElement::Focus() NS_IMETHODIMP nsXULElement::Blur() { + // What kind of crazy tries to blur an element without a doc? + if (!mDocument) + return NS_OK; + // Obtain a presentation context and then call SetFocus. PRInt32 count = mDocument->GetNumberOfShells(); if (count == 0)