From fc4cb4720970d4d49ae3c627eaa42255c4d096ab Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Wed, 14 Jan 2004 08:05:19 +0000 Subject: [PATCH] validation game value before applying --- stepmania/src/StepMania.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index 7a7583b38e..2378047aee 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -716,6 +716,8 @@ static void RestoreAppPri() void ChangeCurrentGame( Game g ) { + ASSERT( g >= 0 && g < NUM_GAMES ); + SaveGamePrefsToDisk(); INPUTMAPPER->SaveMappingsToDisk(); // save mappings before switching the game @@ -759,7 +761,10 @@ void ReadGamePrefsFromDisk( bool bSwitchToLastPlayedGame ) { Game game; if( ini.GetValue("Options", "Game", (int&)game) ) + { + CLAMP( (int&)game, 0, NUM_GAMES-1 ); GAMESTATE->m_CurGame = game; + } } }