diff --git a/browser/components/places/src/nsNavBookmarks.cpp b/browser/components/places/src/nsNavBookmarks.cpp index 47c78c345e0c..570c7a59f668 100644 --- a/browser/components/places/src/nsNavBookmarks.cpp +++ b/browser/components/places/src/nsNavBookmarks.cpp @@ -268,18 +268,20 @@ nsNavBookmarks::InitRoots() nsCOMPtr bookmarksFile; rv = NS_GetSpecialDirectory(NS_APP_BOOKMARKS_50_FILE, getter_AddRefs(bookmarksFile)); - PRBool bookmarksFileExists; - rv = bookmarksFile->Exists(&bookmarksFileExists); - if (NS_SUCCEEDED(rv) && bookmarksFileExists) { - nsCOMPtr ioservice = do_GetService( + if (bookmarksFile) { + PRBool bookmarksFileExists; + rv = bookmarksFile->Exists(&bookmarksFileExists); + if (NS_SUCCEEDED(rv) && bookmarksFileExists) { + nsCOMPtr ioservice = do_GetService( "@mozilla.org/network/io-service;1", &rv); - NS_ENSURE_SUCCESS(rv, rv); - nsCOMPtr bookmarksFileURI; - rv = ioservice->NewFileURI(bookmarksFile, - getter_AddRefs(bookmarksFileURI)); - NS_ENSURE_SUCCESS(rv, rv); - rv = ImportBookmarksHTMLInternal(bookmarksFileURI, PR_FALSE); - NS_ENSURE_SUCCESS(rv, rv); + NS_ENSURE_SUCCESS(rv, rv); + nsCOMPtr bookmarksFileURI; + rv = ioservice->NewFileURI(bookmarksFile, + getter_AddRefs(bookmarksFileURI)); + NS_ENSURE_SUCCESS(rv, rv); + rv = ImportBookmarksHTMLInternal(bookmarksFileURI, PR_FALSE); + NS_ENSURE_SUCCESS(rv, rv); + } } } return NS_OK;