From 3ea21f2ffcc184c6ccf7feea87ec98d1eb2334c1 Mon Sep 17 00:00:00 2001 From: "sicking%bigfoot.com" Date: Sun, 16 Feb 2003 18:08:37 +0000 Subject: [PATCH] Bug 169036: Fix potential crasher by adding a nullcheck. r=jrgm sr=jst a=dbaron --- content/xul/document/src/nsXULDocument.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/content/xul/document/src/nsXULDocument.cpp b/content/xul/document/src/nsXULDocument.cpp index 3b11be30f939..c028c8a84096 100644 --- a/content/xul/document/src/nsXULDocument.cpp +++ b/content/xul/document/src/nsXULDocument.cpp @@ -486,6 +486,10 @@ nsXULDocument::~nsXULDocument() mScriptLoader->DropDocumentReference(); } + if (mNodeInfoManager) { + mNodeInfoManager->DropDocumentReference(); + } + delete mTemplateBuilderTable; delete mBoxObjectTable; @@ -513,11 +517,6 @@ nsXULDocument::~nsXULDocument() NS_RELEASE(gXULCache); } } - - if (mNodeInfoManager) { - mNodeInfoManager->DropDocumentReference(); - } - } @@ -808,6 +807,10 @@ nsXULDocument::GetDocumentURL(nsIURI** aURI) const NS_IMETHODIMP nsXULDocument::GetPrincipal(nsIPrincipal **aPrincipal) { + *aPrincipal = nsnull; + NS_ASSERTION(mMasterPrototype, "Missing master prototype. See bug 169036"); + NS_ENSURE_TRUE(mMasterPrototype, NS_ERROR_UNEXPECTED); + return mMasterPrototype->GetDocumentPrincipal(aPrincipal); }