Blob Blame History Raw
diff -up lincity-ng-1.92.beta/src/lincity-ng/MainLincity.cpp.BAD lincity-ng-1.92.beta/src/lincity-ng/MainLincity.cpp
--- lincity-ng-1.92.beta/src/lincity-ng/MainLincity.cpp.BAD	2008-09-25 15:39:36.000000000 -0400
+++ lincity-ng-1.92.beta/src/lincity-ng/MainLincity.cpp	2008-09-25 16:27:46.000000000 -0400
@@ -110,8 +110,15 @@ void saveCityNG( std::string newFilename
  * Load City and do setup for Lincity NG.
  */
 bool loadCityNG( std::string filename ){
+    std::string dir = "";
     /* FIXME crash on debian etch when 9_currentGameNG.scn does not exist */
-    std::string dir = PHYSFS_getRealDir(filename.c_str());
+    /* If PHYSFS_getRealDir doesn't find the file, it returns NULL. */
+    /* This causes a crash when trying to assign NULL to a std::string. */
+    if ( ! PHYSFS_getRealDir(filename.c_str()) ) {
+	return false;
+    } else {
+	dir = PHYSFS_getRealDir(filename.c_str());
+    }
     filename = dir + PHYSFS_getDirSeparator() + filename;
     if( file_exists( const_cast<char*>( filename.c_str()) ) ){
         load_city_2(const_cast<char*>(filename.c_str()));