From 4d70fe83e9600467d09325f35df133aa35a1ea7a Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Mon, 31 Mar 2008 04:35:29 +0000 Subject: [PATCH] fix crash if GetFirstCompatibleStyle called from title screen --- stepmania/src/SongUtil.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stepmania/src/SongUtil.cpp b/stepmania/src/SongUtil.cpp index 95e493b3ae..8cddc75deb 100644 --- a/stepmania/src/SongUtil.cpp +++ b/stepmania/src/SongUtil.cpp @@ -872,7 +872,10 @@ static void GetPlayableStepsTypes( const Song *pSong, set &vOut ) { bool bShowThisStepsType = find( vstToShow.begin(), vstToShow.end(), *st ) != vstToShow.end(); - const Style *pStyle = GameManager::GetFirstCompatibleStyle( GAMESTATE->m_pCurGame, GAMESTATE->GetNumPlayersEnabled(), *st ); + int iNumPlayers = GAMESTATE->GetNumPlayersEnabled(); + iNumPlayers = max( iNumPlayers, 1 ); + + const Style *pStyle = GameManager::GetFirstCompatibleStyle( GAMESTATE->m_pCurGame, iNumPlayers, *st ); bool bEnoughStages = GAMESTATE->GetSmallestNumStagesLeftForAnyHumanPlayer() >= GAMESTATE->GetNumStagesForSongAndStyleType(pSong, pStyle->m_StyleType); if( bShowThisStepsType && bEnoughStages )