From cafede40f32445b6f7b1c8df0229be1d1c6c2aae Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 11 Jun 2004 05:08:25 +0000 Subject: [PATCH] fix crash if a button is held while recording and still in the lead-in --- stepmania/src/ScreenEdit.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stepmania/src/ScreenEdit.cpp b/stepmania/src/ScreenEdit.cpp index 417fbd484c..c269754661 100644 --- a/stepmania/src/ScreenEdit.cpp +++ b/stepmania/src/ScreenEdit.cpp @@ -443,13 +443,13 @@ void ScreenEdit::Update( float fDeltaTime ) StyleInput StyleI( PLAYER_1, t ); float fSecsHeld = INPUTMAPPER->GetSecsHeld( StyleI ); - if( fSecsHeld > RECORD_HOLD_SECONDS ) + if( fSecsHeld > RECORD_HOLD_SECONDS && GAMESTATE->m_fSongBeat > 0 ) { // add or extend hold const float fHoldStartSeconds = m_soundMusic.GetPositionSeconds() - fSecsHeld; - float fStartBeat = m_pSong->GetBeatFromElapsedTime( fHoldStartSeconds ); - float fEndBeat = GAMESTATE->m_fSongBeat; + float fStartBeat = max( 0, m_pSong->GetBeatFromElapsedTime( fHoldStartSeconds ) ); + float fEndBeat = max( fStartBeat, GAMESTATE->m_fSongBeat ); // Round hold start and end to the nearest snap interval fStartBeat = froundf( fStartBeat, NoteTypeToBeat(m_SnapDisplay.GetNoteType()) );