diff --git a/mozilla/xpfe/appshell/src/nsFileLocations.cpp b/mozilla/xpfe/appshell/src/nsFileLocations.cpp index 3cbc9e0613c..319c0711baa 100644 --- a/mozilla/xpfe/appshell/src/nsFileLocations.cpp +++ b/mozilla/xpfe/appshell/src/nsFileLocations.cpp @@ -98,7 +98,14 @@ static PRBool GetProfileDirectory(nsFileSpec& outSpec) { // one profile exists: use that profile profileService->GetFirstProfile(&currProfileName); - profileService->GetProfileDir(currProfileName, &currProfileDirSpec); + if (currProfileName && (PL_strlen(currProfileName) > 0)) { + profileService->GetProfileDir(currProfileName, &currProfileDirSpec); + } + else { + // this should never happen + PR_FREEIF(currProfileName); + return PR_FALSE; + } } else { @@ -107,20 +114,27 @@ static PRBool GetProfileDirectory(nsFileSpec& outSpec) // (if we can't figure out what the last profile used was for some reason, // we'll pick the first one as returned from the registry query) profileService->GetCurrentProfile(&currProfileName); - if (currProfileName) + if (currProfileName && (PL_strlen(currProfileName) > 0)) { profileService->GetProfileDir(currProfileName, &currProfileDirSpec); + } else { profileService->GetFirstProfile(&currProfileName); - profileService->GetProfileDir(currProfileName, &currProfileDirSpec); + if (currProfileName && (PL_strlen(currProfileName) > 0)) { + profileService->GetProfileDir(currProfileName, &currProfileDirSpec); + } } } + if (!currProfileName || (PL_strlen(currProfileName) == 0)) { + // we don't have it, return false. + PR_FREEIF(currProfileName); + return PR_FALSE; + } #if defined(NS_DEBUG) - if (currProfileName) - { - printf("ProfileName : %s\n", currProfileName); - printf("ProfileDir : %s\n", currProfileDirSpec.GetNativePathCString()); - } + if (currProfileName) { + printf("ProfileName : %s\n", currProfileName); + printf("ProfileDir : %s\n", currProfileDirSpec.GetNativePathCString()); + } #endif /* NS_DEBUG */ PR_FREEIF(currProfileName); if (!currProfileDirSpec.Exists())