diff --git a/stepmania/src/IniFile.cpp b/stepmania/src/IniFile.cpp index 58c85e15dd..f38d4814b0 100644 --- a/stepmania/src/IniFile.cpp +++ b/stepmania/src/IniFile.cpp @@ -92,6 +92,10 @@ bool IniFile::ReadFile() void IniFile::WriteFile() { FILE* fp = fopen( path, "w" ); + + if( fp == NULL ) + return; + for (keymap::const_iterator k = keys.begin(); k != keys.end(); ++k) { if (k->second.empty()) diff --git a/stepmania/src/NotesWriterSM.cpp b/stepmania/src/NotesWriterSM.cpp index ffdbe50a0d..3e251f8c5b 100644 --- a/stepmania/src/NotesWriterSM.cpp +++ b/stepmania/src/NotesWriterSM.cpp @@ -3,6 +3,7 @@ #include "Notes.h" #include "RageUtil.h" #include "GameManager.h" +#include "RageLog.h" void NotesWriterSM::WriteGlobalTags(FILE *fp, const Song &out) { @@ -95,7 +96,10 @@ bool NotesWriterSM::Write(CString sPath, const Song &out, bool bSavingCache) FILE* fp = fopen( sPath, "w" ); if( fp == NULL ) - RageException::Throw( "Error opening song file '%s' for writing.", sPath.GetString() ); + { + LOG->Warn( "Error opening song file '%s' for writing.", sPath.GetString() ); + return false; + } WriteGlobalTags(fp, out); if(bSavingCache) { diff --git a/stepmania/src/RageLog.cpp b/stepmania/src/RageLog.cpp index 603fac4c2b..708461e08a 100644 --- a/stepmania/src/RageLog.cpp +++ b/stepmania/src/RageLog.cpp @@ -45,7 +45,8 @@ RageLog::~RageLog() { Flush(); FreeConsole(); - fclose( m_fileLog ); + if( m_fileLog ) + fclose( m_fileLog ); } void RageLog::ShowConsole() @@ -68,7 +69,8 @@ void RageLog::Trace( const char *fmt, ...) CString sBuff = vssprintf( fmt, va ); va_end(va); - fprintf( m_fileLog, "%s\n", sBuff.GetString() ); + if( m_fileLog ) + fprintf( m_fileLog, "%s\n", sBuff.GetString() ); printf( "%s\n", sBuff.GetString() ); CrashLog(sBuff);