Don't add random entries (pSong = NULL) to vSongs. Assert that pSong is never NULL.

This commit is contained in:
Steve Checkoway
2006-07-02 22:02:59 +00:00
parent d3c12feb91
commit 14b91aea37
+3 -1
View File
@@ -37,7 +37,8 @@ void ScreenJukebox::SetSong()
Course *pCourse = SONGMAN->GetCourseFromName( THEME->GetCurThemeName() );
if( pCourse != NULL )
for ( unsigned i = 0; i < pCourse->m_vEntries.size(); i++ )
vSongs.push_back( pCourse->m_vEntries[i].pSong );
if( pCourse->m_vEntries[i].IsFixedSong() )
vSongs.push_back( pCourse->m_vEntries[i].pSong );
if ( vSongs.size() == 0 )
SONGMAN->GetSongs( vSongs, GAMESTATE->m_sPreferredSongGroup );
@@ -78,6 +79,7 @@ void ScreenJukebox::SetSong()
Song* pSong = vSongs[RandomInt(vSongs.size())];
ASSERT( pSong != NULL );
if( !pSong->HasMusic() )
continue; // skip
if( UNLOCKMAN->SongIsLocked(pSong) )