Bug #42836 --> attempt to fix crash on linux with migrated profiles by adding some null ptr checks.

r=putterman
This commit is contained in:
mscott%netscape.com 2000-06-16 23:45:38 +00:00
Родитель e595cc9cc7
Коммит 2a981734c9
1 изменённых файлов: 17 добавлений и 14 удалений

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

@ -123,22 +123,25 @@ NS_IMETHODIMP nsNoIncomingServer::CopyDefaultMessages(const char *folderNameOnDi
rv = chromeRegistry->GetSelectedLocale(tmpstr.GetUnicode(), getter_Copies(lc_name));
if (NS_SUCCEEDED(rv)) {
nsAutoString localeStr(lc_name);
if (!localeStr.IsEmpty())
{
nsCOMPtr<nsIFileSpec> tmpdataFilesDir;
rv = NS_NewFileSpec(getter_AddRefs(tmpdataFilesDir));
NS_ENSURE_SUCCESS(rv,rv);
rv = tmpdataFilesDir->FromFileSpec(defaultMessagesFile);
NS_ENSURE_SUCCESS(rv,rv);
nsCOMPtr<nsIFileSpec> tmpdataFilesDir;
rv = NS_NewFileSpec(getter_AddRefs(tmpdataFilesDir));
NS_ENSURE_SUCCESS(rv,rv);
rv = tmpdataFilesDir->FromFileSpec(defaultMessagesFile);
NS_ENSURE_SUCCESS(rv,rv);
tmpdataFilesDir->AppendRelativeUnixPath(NS_ConvertUCS2toUTF8(lc_name));
NS_ENSURE_SUCCESS(rv,rv);
rv = tmpdataFilesDir->Exists(&exists);
NS_ENSURE_SUCCESS(rv,rv);
if (exists) {
// use locale provider instead
rv = defaultMessagesFile->AppendRelativeUnixPath(NS_ConvertUCS2toUTF8(lc_name));
NS_ENSURE_SUCCESS(rv,rv);
tmpdataFilesDir->AppendRelativeUnixPath(NS_ConvertUCS2toUTF8(lc_name));
NS_ENSURE_SUCCESS(rv,rv);
rv = tmpdataFilesDir->Exists(&exists);
NS_ENSURE_SUCCESS(rv,rv);
if (exists) {
// use locale provider instead
rv = defaultMessagesFile->AppendRelativeUnixPath(NS_ConvertUCS2toUTF8(lc_name));
NS_ENSURE_SUCCESS(rv,rv);
}
}
else return rv;
}
}