From 96c2e2ad7ebf9b0e82533ac36b913587918f11d7 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 5 Sep 2003 20:10:40 +0000 Subject: [PATCH] ChangeToDirOfExecutable uses FDB before LOG exists. Fix potential crashes. --- stepmania/src/RageUtil_FileDB.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/stepmania/src/RageUtil_FileDB.cpp b/stepmania/src/RageUtil_FileDB.cpp index 6563bfb66c..076512f595 100644 --- a/stepmania/src/RageUtil_FileDB.cpp +++ b/stepmania/src/RageUtil_FileDB.cpp @@ -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());