add some bulletproofing. r=davidm
git-svn-id: svn://10.0.0.236/trunk@50204 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user