Fix for bug 25321 "Crash at start w/o internet connection" on Mac. Added additional check for failure of GetService() on nsIOService. r=brade, a=jar.

This commit is contained in:
gordon%netscape.com 2000-02-27 08:26:32 +00:00
Родитель aa9cb674b5
Коммит 6d1972b0be
1 изменённых файлов: 9 добавлений и 9 удалений

Просмотреть файл

@ -29,24 +29,24 @@
static NS_DEFINE_IID(kIPersistentPropertiesIID, NS_IPERSISTENTPROPERTIES_IID);
static NS_DEFINE_IID(kIOServiceCID, NS_IOSERVICE_CID);
nsIIOService* nsURLProperties::gIOService;
nsIIOService* nsURLProperties::gIOService = nsnull;
nsrefcnt nsURLProperties::gRefCnt = 0;
nsURLProperties::nsURLProperties(nsString& aUrl)
{
if (gRefCnt++ == 0) {
nsresult rv;
rv = nsServiceManager::GetService(kIOServiceCID,
NS_GET_IID(nsIIOService),
(nsISupports**)&gIOService);
NS_ASSERTION(NS_SUCCEEDED(rv), "can't get nsIOService");
}
mDelegate = nsnull;
nsresult res = NS_OK;
nsIURI* url = nsnull;
nsIInputStream* in = nsnull;
if (gRefCnt == 0) {
res = nsServiceManager::GetService(kIOServiceCID,
NS_GET_IID(nsIIOService),
(nsISupports**)&gIOService);
if (NS_FAILED(res)) return;
gRefCnt++;
}
nsCAutoString aUrlCString(aUrl);
res = gIOService->NewURI(aUrlCString.GetBuffer(), nsnull, &url);
if (NS_FAILED(res)) return;