Adding critical check for null.

removing unneded assignment to temp var.


git-svn-id: svn://10.0.0.236/trunk@66968 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
dougt%netscape.com
2000-04-24 06:08:48 +00:00
parent 9770a6681b
commit 354bfa7dc3

View File

@@ -116,31 +116,33 @@ nsInstallFolder::nsInstallFolder(const nsString& aFolderID, const nsString& aRel
// if it already exists...
nsCOMPtr<nsILocalFile> dirCheck;
NS_NewLocalFile(aFolderID.ToNewCString(), getter_AddRefs(dirCheck));
dirCheck->IsDirectory(&flagIsDir);
dirCheck->Exists(&flagExists);
if ( flagIsDir || !flagExists )
if (dirCheck)
{
mFileSpec = dirCheck;
if (mFileSpec && aRelativePath.Length() > 0 )
dirCheck->IsDirectory(&flagIsDir);
dirCheck->Exists(&flagExists);
if ( flagIsDir || !flagExists )
{
// we've got a subdirectory to tack on
nsString morePath(aRelativePath);
mFileSpec = dirCheck;
//if ( morePath.Last() != '/' || morePath.Last() != '\\' )
// morePath.AppendWithConversion('/');
if (mFileSpec && aRelativePath.Length() > 0 )
{
// 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)
{
MOZ_COUNT_CTOR(nsInstallFolder);
@@ -291,17 +293,7 @@ nsInstallFolder::SetDirectoryPath(const nsString& aFolderID, const nsString& aRe
case 109: /////////////////////////////////////////////////////////// File URL
{
if (aRelativePath.IsEmpty())
{
mFileSpec = nsnull;
return;
}
nsCOMPtr<nsILocalFile> temp;
nsString tempFileURLString = aFolderID;
tempFileURLString += aRelativePath;
NS_NewLocalFile(aRelativePath.ToNewCString(), getter_AddRefs(temp));
mFileSpec = temp;