From 6d0928efa15f61e2f6f034453a519b2296adc146 Mon Sep 17 00:00:00 2001 From: "gavin%gavinsharp.com" Date: Tue, 2 Aug 2005 23:08:52 +0000 Subject: [PATCH] Bug 247427 followup fix: ensure file exists before trying to open it, patch by O. Atsushi (Torisugari) , r+a=bsmedberg --- .../migration/src/nsNetscapeProfileMigratorBase.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/browser/components/migration/src/nsNetscapeProfileMigratorBase.cpp b/browser/components/migration/src/nsNetscapeProfileMigratorBase.cpp index 40a339bc7ea2..91d2b629fc39 100644 --- a/browser/components/migration/src/nsNetscapeProfileMigratorBase.cpp +++ b/browser/components/migration/src/nsNetscapeProfileMigratorBase.cpp @@ -77,6 +77,13 @@ nsNetscapeProfileMigratorBase::GetProfileDataFromRegistry(nsILocalFile* aRegistr { nsresult rv = NS_OK; + // Ensure aRegistryFile exists before open it + PRBool regFileExists = PR_FALSE; + rv = aRegistryFile->Exists(®FileExists); + NS_ENSURE_SUCCESS(rv, rv); + if (!regFileExists) + return NS_ERROR_FILE_NOT_FOUND; + // Open It nsCOMPtr reg(do_CreateInstance("@mozilla.org/registry;1")); reg->Open(aRegistryFile);