ChangeToDirOfExecutable uses FDB before LOG exists. Fix potential

crashes.
This commit is contained in:
Glenn Maynard
2003-09-05 20:10:40 +00:00
parent c7312adc90
commit 96c2e2ad7e
+3 -2
View File
@@ -77,7 +77,8 @@ void FileSet::LoadFromDir(const CString &dir)
if( chdir(dir.c_str()) == -1 )
{
/* Only log once per dir. */
LOG->MapLog("chdir " + dir, "Couldn't chdir(%s): %s", dir.c_str(), strerror(errno) );
if( LOG )
LOG->MapLog("chdir " + dir, "Couldn't chdir(%s): %s", dir.c_str(), strerror(errno) );
return;
}
DIR *d = opendir(".");
@@ -278,7 +279,7 @@ bool FilenameDB::ResolvePath(CString &path)
/* If there were no matches, the path isn't found. */
if(lst.empty()) return false;
if(lst.size() > 1)
if( lst.size() > 1 && LOG )
LOG->Warn("Ambiguous filenames '%s' and '%s'",
lst[0].c_str(), lst[1].c_str());