fix crashes if 0 rows are enabled (e.g. keyboard shortcut minimenu)

This commit is contained in:
Chris Danford
2005-03-21 13:21:40 +00:00
parent 042ba4d6c2
commit e3ced3f32d
+7 -1
View File
@@ -376,7 +376,10 @@ void ScreenOptions::PositionCursors()
FOREACH_HumanPlayer( pn )
{
const int iRow = m_iCurrentRow[pn];
ASSERT_M( iRow < (int)m_Rows.size(), ssprintf("%i < %i", iRow, (int)m_Rows.size() ) );
if( iRow == -1 )
continue;
ASSERT_M( iRow >= 0 && iRow < (int)m_Rows.size(), ssprintf("%i < %i", iRow, (int)m_Rows.size() ) );
OptionRow &OptionRow = *m_Rows[iRow];
OptionsCursor &cursor = m_Cursor[pn];
@@ -639,6 +642,9 @@ void ScreenOptions::OnChange( PlayerNumber pn )
return;
const int iCurRow = m_iCurrentRow[pn];
if( iCurRow == -1 )
return;
/* Update m_fY and m_bHidden[]. */
PositionItems();