Fixed crash in demo if no songs.

This commit is contained in:
Chris Danford
2003-01-19 21:05:03 +00:00
parent 2e10cb86df
commit d84e10f9d2
4 changed files with 23 additions and 5 deletions
+7 -5
View File
@@ -54,11 +54,7 @@ bool SetUpSongOptions() // always return true.
{
Song* pSong = SONGMAN->GetRandomSong();
if( pSong == NULL ) // returns NULL there are no songs
{
// we didn't find a song. Abort demonstration.
SCREENMAN->SendMessageToTopScreen( SM_GoToNextScreen, 0 );
return true;
}
return true; // we need to detect this and abort demonstration later
if( pSong->m_apNotes.empty() )
continue; // skip
@@ -141,6 +137,12 @@ ScreenDemonstration::ScreenDemonstration() : ScreenGameplay(SetUpSongOptions())
LOG->Trace( "ScreenDemonstration::ScreenDemonstration()" );
GAMESTATE->m_bDemonstration = true;
if( GAMESTATE->m_pCurSong == NULL ) // we didn't find a song.
{
this->SendScreenMessage( SM_GoToNextScreen, 0 ); // Abort demonstration.
return;
}
m_sprDemonstrationOverlay.Load( THEME->GetPathTo("Graphics","demonstration overlay") );
m_sprDemonstrationOverlay.SetXY( CENTER_X, CENTER_Y );