From 290c281cf860c3bf2f8087c55f27a9298fbb6c87 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 1 Jan 2003 09:19:10 +0000 Subject: [PATCH] stop dying on corrupt ksfs --- stepmania/src/NotesLoaderKSF.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/stepmania/src/NotesLoaderKSF.cpp b/stepmania/src/NotesLoaderKSF.cpp index ccd4e9f866..746c2077c0 100644 --- a/stepmania/src/NotesLoaderKSF.cpp +++ b/stepmania/src/NotesLoaderKSF.cpp @@ -102,7 +102,12 @@ bool KSFLoader::LoadFromKSFFile( const CString &sPath, Notes &out ) if( sRowString == "2222222222222" ) break; - ASSERT( sRowString.GetLength() == 13 ); // why 13 notes per row. Beats me! + if(sRowString.size() != 13) + { + LOG->Warn("File %s had a RowString with an improper length (\"%s\"); corrupt notes ignored", + sPath.GetString(), sRowString.GetString()); + return false; + } // the length of a note in a row depends on TICKCOUNT float fBeatThisRow = r/(float)iTickCount; @@ -158,6 +163,7 @@ bool KSFLoader::LoadFromDir( CString sDir, Song &out ) CStringArray arrayKSFFileNames; GetDirListing( sDir + CString("*.ksf"), arrayKSFFileNames ); + /* We shouldn't have been called to begin with if there were no KSFs. */ if( arrayKSFFileNames.empty() ) RageException::Throw( "Couldn't find any KSF files in '%s'", sDir.GetString() ); @@ -166,12 +172,19 @@ bool KSFLoader::LoadFromDir( CString sDir, Song &out ) for( i=0; i