Check to make sure that you have content in the doc before doing GetElementById(). (This was causing crash in SearchForNodeByID() -- thanks to law@netscape.com for the fix.)

git-svn-id: svn://10.0.0.236/trunk@25794 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
waterson%netscape.com
1999-04-01 02:30:03 +00:00
parent 134129597b
commit 85d3b90bc2
2 changed files with 8 additions and 0 deletions

View File

@@ -2321,6 +2321,10 @@ XULDocumentImpl::GetRdf(nsIRDFService** aRDFService)
NS_IMETHODIMP
XULDocumentImpl::GetElementById(const nsString& aId, nsIDOMElement** aReturn)
{
NS_PRECONDITION(mRootContent != nsnull, "document contains no content");
if (! mRootContent)
return NS_ERROR_NOT_INITIALIZED; // XXX right error code?
nsresult rv;
nsAutoString uri(aId);

View File

@@ -2321,6 +2321,10 @@ XULDocumentImpl::GetRdf(nsIRDFService** aRDFService)
NS_IMETHODIMP
XULDocumentImpl::GetElementById(const nsString& aId, nsIDOMElement** aReturn)
{
NS_PRECONDITION(mRootContent != nsnull, "document contains no content");
if (! mRootContent)
return NS_ERROR_NOT_INITIALIZED; // XXX right error code?
nsresult rv;
nsAutoString uri(aId);