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

From master branch
This commit is contained in:
jean-pierre charras 2020-06-14 17:39:19 +02:00
parent 56a17b4e68
commit 567ce48cc1
2 changed files with 4 additions and 2 deletions

View File

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

View File

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