From f8c71ef85ca090e9cb8c5b7ab16c54e2de8caa23 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sun, 6 Jun 2004 20:18:50 +0000 Subject: [PATCH] fix possible AVs --- stepmania/src/CourseContentsList.cpp | 7 +++++-- stepmania/src/CourseEntryDisplay.cpp | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/stepmania/src/CourseContentsList.cpp b/stepmania/src/CourseContentsList.cpp index 831a39804d..682c39d203 100644 --- a/stepmania/src/CourseContentsList.cpp +++ b/stepmania/src/CourseContentsList.cpp @@ -74,12 +74,15 @@ void CourseContentsList::SetFromGameState() CourseEntryDisplay& display = m_CourseContentDisplays[m_iNumContents]; const TrailEntry* pte[NUM_PLAYERS]; + ZERO( pte ); + FOREACH_EnabledPlayer(pn) { Trail* pTrail = GAMESTATE->m_pCurTrail[pn]; if( pTrail == NULL ) - continue; - pte[pn] = &pTrail->m_vEntries[i]; + continue; // skip + if( i < pTrail->m_vEntries.size() ) + pte[pn] = &pTrail->m_vEntries[i]; } display.LoadFromTrailEntry( m_iNumContents+1, pte ); diff --git a/stepmania/src/CourseEntryDisplay.cpp b/stepmania/src/CourseEntryDisplay.cpp index a2f5bf4b9d..2dfc3ba7d7 100644 --- a/stepmania/src/CourseEntryDisplay.cpp +++ b/stepmania/src/CourseEntryDisplay.cpp @@ -90,6 +90,8 @@ void CourseEntryDisplay::SetDifficulty( PlayerNumber pn, const CString &text, Ra void CourseEntryDisplay::LoadFromTrailEntry( int iNum, const TrailEntry *tes[NUM_PLAYERS] ) { const TrailEntry *te = tes[GAMESTATE->m_MasterPlayerNumber]; + if( te == NULL ) + return; bool bMystery = te->bMystery; if( bMystery ) { @@ -115,6 +117,8 @@ void CourseEntryDisplay::LoadFromTrailEntry( int iNum, const TrailEntry *tes[NUM FOREACH_EnabledPlayer(pn) { const TrailEntry *te = tes[pn]; + if( te == NULL ) + continue; RageColor colorNotes = SONGMAN->GetDifficultyColor( te->pSteps->GetDifficulty() ); SetDifficulty( pn, ssprintf("%d", te->pSteps->GetMeter()), colorNotes ); }