From de8f3449d54495b849e7a05aefa13ba57f45d6aa Mon Sep 17 00:00:00 2001 From: "waterson%netscape.com" Date: Tue, 5 Oct 1999 22:22:40 +0000 Subject: [PATCH] Fix crasher when loading XUL in viewer and no localstore is present. --- content/xul/document/src/nsXULDocument.cpp | 7 +++++-- rdf/content/src/nsXULDocument.cpp | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/content/xul/document/src/nsXULDocument.cpp b/content/xul/document/src/nsXULDocument.cpp index dfe34a024c6e..4ff5bba97365 100644 --- a/content/xul/document/src/nsXULDocument.cpp +++ b/content/xul/document/src/nsXULDocument.cpp @@ -3757,13 +3757,16 @@ XULDocumentImpl::Init(void) rv = nsServiceManager::GetService(kLocalStoreCID, NS_GET_IID(nsIRDFDataSource), (nsISupports**) &localstore); - mLocalStore = localstore; - NS_IF_RELEASE(localstore); // this _could_ fail; e.g., if we've tried to grab the local store // before profiles have initialized. If so, no big deal; nothing // will persist. + if (NS_SUCCEEDED(rv)) { + mLocalStore = localstore; + NS_IF_RELEASE(localstore); + } + #if 0 // construct a selection object if (NS_FAILED(rv = nsComponentManager::CreateInstance(kRangeListCID, diff --git a/rdf/content/src/nsXULDocument.cpp b/rdf/content/src/nsXULDocument.cpp index dfe34a024c6e..4ff5bba97365 100644 --- a/rdf/content/src/nsXULDocument.cpp +++ b/rdf/content/src/nsXULDocument.cpp @@ -3757,13 +3757,16 @@ XULDocumentImpl::Init(void) rv = nsServiceManager::GetService(kLocalStoreCID, NS_GET_IID(nsIRDFDataSource), (nsISupports**) &localstore); - mLocalStore = localstore; - NS_IF_RELEASE(localstore); // this _could_ fail; e.g., if we've tried to grab the local store // before profiles have initialized. If so, no big deal; nothing // will persist. + if (NS_SUCCEEDED(rv)) { + mLocalStore = localstore; + NS_IF_RELEASE(localstore); + } + #if 0 // construct a selection object if (NS_FAILED(rv = nsComponentManager::CreateInstance(kRangeListCID,