fix crash when selecting course mods in editor
This commit is contained in:
@@ -542,6 +542,8 @@ void NoteField::DrawPrimitives()
|
||||
const Course *pCourse = GAMESTATE->m_pCurCourse;
|
||||
if( pCourse )
|
||||
{
|
||||
ASSERT_M( GAMESTATE->m_iEditCourseEntryIndex > 0 && GAMESTATE->m_iEditCourseEntryIndex < (int)pCourse->m_vEntries.size(),
|
||||
ssprintf("%i",GAMESTATE->m_iEditCourseEntryIndex.Get()) );
|
||||
const CourseEntry &ce = pCourse->m_vEntries[GAMESTATE->m_iEditCourseEntryIndex];
|
||||
FOREACH_CONST( Attack, ce.attacks, a )
|
||||
{
|
||||
|
||||
@@ -2406,7 +2406,18 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
|
||||
{
|
||||
const RString name = g_CourseMode.rows[0].choices[num];
|
||||
Course *pCourse = SONGMAN->FindCourse( name );
|
||||
|
||||
int iCourseEntryIndex = -1;
|
||||
FOREACH_CONST( CourseEntry, pCourse->m_vEntries, i )
|
||||
{
|
||||
if( i->pSong == GAMESTATE->m_pCurSong.Get() )
|
||||
iCourseEntryIndex = i - pCourse->m_vEntries.begin();
|
||||
}
|
||||
|
||||
ASSERT( iCourseEntryIndex != -1 );
|
||||
|
||||
GAMESTATE->m_pCurCourse.Set( pCourse );
|
||||
GAMESTATE->m_iEditCourseEntryIndex.Set( iCourseEntryIndex );
|
||||
ASSERT( GAMESTATE->m_pCurCourse );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user