Adding critical check for null.

removing unneded assignment to temp var.
This commit is contained in:
dougt%netscape.com 2000-04-24 06:08:48 +00:00
Родитель 2bac8b3ccc
Коммит b2d97a1c4d
1 изменённых файлов: 18 добавлений и 26 удалений

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

@ -116,31 +116,33 @@ nsInstallFolder::nsInstallFolder(const nsString& aFolderID, const nsString& aRel
// if it already exists... // if it already exists...
nsCOMPtr<nsILocalFile> dirCheck; nsCOMPtr<nsILocalFile> dirCheck;
NS_NewLocalFile(aFolderID.ToNewCString(), getter_AddRefs(dirCheck)); NS_NewLocalFile(aFolderID.ToNewCString(), getter_AddRefs(dirCheck));
dirCheck->IsDirectory(&flagIsDir); if (dirCheck)
dirCheck->Exists(&flagExists);
if ( flagIsDir || !flagExists )
{ {
mFileSpec = dirCheck; dirCheck->IsDirectory(&flagIsDir);
dirCheck->Exists(&flagExists);
if (mFileSpec && aRelativePath.Length() > 0 ) if ( flagIsDir || !flagExists )
{ {
// we've got a subdirectory to tack on mFileSpec = dirCheck;
nsString morePath(aRelativePath);
//if ( morePath.Last() != '/' || morePath.Last() != '\\' ) if (mFileSpec && aRelativePath.Length() > 0 )
// morePath.AppendWithConversion('/'); {
// we've got a subdirectory to tack on
nsString morePath(aRelativePath);
mFileSpec->Append(morePath.ToNewCString()); //if ( morePath.Last() != '/' || morePath.Last() != '\\' )
// morePath.AppendWithConversion('/');
mFileSpec->Append(morePath.ToNewCString());
}
// make sure that the directory is created.
// XXX: **why** are we creating these? they might not be used!
// nsFileSpec(mFileSpec->GetCString(), PR_TRUE);
} }
// make sure that the directory is created.
// XXX: **why** are we creating these? they might not be used!
// nsFileSpec(mFileSpec->GetCString(), PR_TRUE);
} }
} }
} }
nsInstallFolder::nsInstallFolder(nsInstallFolder& inFolder, const nsString& subString) nsInstallFolder::nsInstallFolder(nsInstallFolder& inFolder, const nsString& subString)
{ {
MOZ_COUNT_CTOR(nsInstallFolder); MOZ_COUNT_CTOR(nsInstallFolder);
@ -291,17 +293,7 @@ nsInstallFolder::SetDirectoryPath(const nsString& aFolderID, const nsString& aRe
case 109: /////////////////////////////////////////////////////////// File URL case 109: /////////////////////////////////////////////////////////// File URL
{ {
if (aRelativePath.IsEmpty())
{
mFileSpec = nsnull;
return;
}
nsCOMPtr<nsILocalFile> temp; nsCOMPtr<nsILocalFile> temp;
nsString tempFileURLString = aFolderID;
tempFileURLString += aRelativePath;
NS_NewLocalFile(aRelativePath.ToNewCString(), getter_AddRefs(temp)); NS_NewLocalFile(aRelativePath.ToNewCString(), getter_AddRefs(temp));
mFileSpec = temp; mFileSpec = temp;