From 48c8ce557993a13827ed67bb49a4606ed593f770 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Thu, 1 Jan 2004 22:19:02 +0000 Subject: [PATCH] NoteData::SetNumTracks: Remove all hold notes that are out of bounds. Fixes crashes after using "create from copy" in the editor menu. --- stepmania/src/NoteData.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/stepmania/src/NoteData.cpp b/stepmania/src/NoteData.cpp index eb67f69119..32cfa7cbcf 100644 --- a/stepmania/src/NoteData.cpp +++ b/stepmania/src/NoteData.cpp @@ -51,6 +51,11 @@ void NoteData::SetNumTracks( int iNewNumTracks ) else m_TapNotes[t].clear(); } + + /* Remove all hold notes that are out of bounds. */ + for( int h = m_HoldNotes.size()-1; h >= 0; --h ) + if( m_HoldNotes[h].iTrack >= iNewNumTracks ) + m_HoldNotes.erase( m_HoldNotes.begin()+h ); }