[ScreenNetEvaluation] Don't assume every theme has a Grade display and/or Points display; this fixes crashes in themes which don't have them.

This commit is contained in:
AJ Kelly
2010-05-25 01:14:44 -05:00
parent ac64504077
commit d2e15bc67e
+4 -3
View File
@@ -178,10 +178,11 @@ void ScreenNetEvaluation::UpdateStats()
if( m_iCurrentPlayer >= (int) NSMAN->m_EvalPlayerData.size() ) if( m_iCurrentPlayer >= (int) NSMAN->m_EvalPlayerData.size() )
return; return;
// XXX: These commands assume that grades and score are shown in the theme // Only run these commands if the theme has these things shown; not every
// on ScreenNetEvaluation, which is not always the case. If a theme doesn't // theme has them, so don't assume. -aj
// have these elements for whatever reason, a crash will occur. -aj if( THEME->GetMetricB(m_sName,"ShowGradeArea") )
m_Grades[m_pActivePlayer].SetGrade( (Grade)NSMAN->m_EvalPlayerData[m_iCurrentPlayer].grade ); m_Grades[m_pActivePlayer].SetGrade( (Grade)NSMAN->m_EvalPlayerData[m_iCurrentPlayer].grade );
if( THEME->GetMetricB(m_sName,"ShowScoreArea") )
m_textScore[m_pActivePlayer].SetTargetNumber( NSMAN->m_EvalPlayerData[m_iCurrentPlayer].score ); m_textScore[m_pActivePlayer].SetTargetNumber( NSMAN->m_EvalPlayerData[m_iCurrentPlayer].score );
//Values greater than 6 will cause a crash //Values greater than 6 will cause a crash