panel lib tables: avoid crash when deleting the last entry in list.

This commit is contained in:
jean-pierre charras 2020-06-14 17:39:19 +02:00
parent 461d0e9a49
commit a8d5d9b690
2 changed files with 4 additions and 2 deletions

View File

@ -567,7 +567,8 @@ void PANEL_SYM_LIB_TABLE::deleteRowHandler( wxCommandEvent& event )
}
}
m_cur_grid->SetGridCursor( std::min( curRow, m_cur_grid->GetNumberRows() - 1 ), curCol );
if( m_cur_grid->GetNumberRows() > 0 && curRow >= 0 )
m_cur_grid->SetGridCursor( std::min( curRow, m_cur_grid->GetNumberRows() - 1 ), curCol );
}

View File

@ -660,7 +660,8 @@ void PANEL_FP_LIB_TABLE::deleteRowHandler( wxCommandEvent& event )
}
}
m_cur_grid->SetGridCursor( std::min( curRow, m_cur_grid->GetNumberRows() - 1 ), curCol );
if( m_cur_grid->GetNumberRows() > 0 && curRow >= 0 )
m_cur_grid->SetGridCursor( std::min( curRow, m_cur_grid->GetNumberRows() - 1 ), curCol );
}