Don't trip over a stale sort column index. (KICAD-B3X)

This commit is contained in:
Jeff Young 2025-07-04 15:33:12 -06:00
parent 86280d5a65
commit e1d1243a91

View File

@ -392,6 +392,8 @@ bool FIELDS_EDITOR_GRID_DATA_MODEL::cmp( const DATA_MODEL_ROW& lhGroup,
};
// Primary sort key is sortCol; secondary is always REFERENCE (column 0)
if( sortCol < 0 || sortCol >= dataModel->GetNumberCols() )
sortCol = 0;
wxString lhs = dataModel->GetValue( lhGroup, sortCol ).Trim( true ).Trim( false );
wxString rhs = dataModel->GetValue( rhGroup, sortCol ).Trim( true ).Trim( false );