Fix broken loop logic.

Fixes https://gitlab.com/kicad/code/kicad/issues/13168
This commit is contained in:
Jeff Young 2022-12-15 14:21:38 +00:00
parent 366cad1f01
commit 5ef9fbdd19
1 changed files with 2 additions and 6 deletions

View File

@ -579,7 +579,7 @@ void DIALOG_SYMBOL_PROPERTIES::OnEditSpiceModel( wxCommandEvent& event )
} }
// Remove any deleted fields // Remove any deleted fields
for( int ii = (int) m_fields->size() - 1; ii >= 0; /* advance in loop */ ) for( int ii = (int) m_fields->size() - 1; ii >= 0; --ii )
{ {
SCH_FIELD& existingField = m_fields->at( ii ); SCH_FIELD& existingField = m_fields->at( ii );
bool found = false; bool found = false;
@ -593,11 +593,7 @@ void DIALOG_SYMBOL_PROPERTIES::OnEditSpiceModel( wxCommandEvent& event )
} }
} }
if( found ) if( !found )
{
ii--;
}
else
{ {
m_fields->erase( m_fields->begin() + ii ); m_fields->erase( m_fields->begin() + ii );
wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_DELETED, ii, 1 ); wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_DELETED, ii, 1 );