Fix a crash after clicking 'delete' button with empty Template Field Names grid

This commit is contained in:
Maciej Suminski 2018-11-29 14:09:07 +01:00
parent 59b0f553e0
commit 6d8ca311f8
1 changed files with 1 additions and 1 deletions

View File

@ -86,7 +86,7 @@ void PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::OnDeleteButtonClick( wxCommandEvent& ev
int curRow = m_grid->GetGridCursorRow(); int curRow = m_grid->GetGridCursorRow();
if( curRow >= 0 ) if( curRow >= 0 && curRow < m_fields.size() )
{ {
m_fields.erase( m_fields.begin() + curRow ); m_fields.erase( m_fields.begin() + curRow );
m_grid->DeleteRows( curRow ); m_grid->DeleteRows( curRow );