From c27418fbbfb771cb40589312289c69d35b6f06fa Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 28 Apr 2004 01:26:32 +0000 Subject: [PATCH] don't throw if a song uses an unknown audio type --- stepmania/src/Song.cpp | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index 4f3d44c346..5e65b5acd8 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -499,19 +499,26 @@ void Song::TidyUpData() CString error; SoundReader *Sample = SoundReader_FileReader::OpenFile( GetMusicPath(), error ); if( Sample == NULL ) - RageException::Throw( "Error opening sound '%s': '%s'", - GetMusicPath().c_str(), error.c_str()); - - m_fMusicLengthSeconds = Sample->GetLength() / 1000.0f; - delete Sample; - - if(m_fMusicLengthSeconds == -1) { - /* It failed; bad file or something. It's already logged a warning, - * so just set the file to 0 seconds. */ - m_fMusicLengthSeconds = 0; - } else if(m_fMusicLengthSeconds == 0) { - LOG->Warn("File %s is empty?", GetMusicPath().c_str()); + LOG->Warn( "Error opening sound \"%s\": %s", GetMusicPath().c_str(), error.c_str() ); + + /* Don't use this file. */ + m_sMusicFile = ""; + } + else + { + m_fMusicLengthSeconds = Sample->GetLength() / 1000.0f; + delete Sample; + + if( m_fMusicLengthSeconds < 0 ) + { + /* It failed; bad file or something. It's already logged a warning. */ + m_fMusicLengthSeconds = 100; // guess + } + else if( m_fMusicLengthSeconds == 0 ) + { + LOG->Warn( "File %s is empty?", GetMusicPath().c_str() ); + } } } else // ! HasMusic()