From 973172109db70bd6c8c642ed090879a2ee2ed6c7 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Mon, 2 May 2005 12:54:27 +0000 Subject: [PATCH] fix out of range access when MenuTimer gets a very large Update --- stepmania/src/MenuTimer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stepmania/src/MenuTimer.cpp b/stepmania/src/MenuTimer.cpp index 0717b66207..9a3c0a72f1 100644 --- a/stepmania/src/MenuTimer.cpp +++ b/stepmania/src/MenuTimer.cpp @@ -70,7 +70,8 @@ void MenuTimer::Update( float fDeltaTime ) const float fNewSecondsLeft = m_fSecondsLeft; const int iOldDisplay = (int)(fOldSecondsLeft + 0.99f); - const int iNewDisplay = (int)(fNewSecondsLeft + 0.99f); + int iNewDisplay = (int)(fNewSecondsLeft + 0.99f); + iNewDisplay = max( iNewDisplay, 0 ); if( fOldSecondsLeft > 5.5 && fNewSecondsLeft < 5.5 ) // transition to below 5.5 SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo("hurry up") );