mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 18:23:15 +02:00
bom export: don't break column order on mismatched column counts
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/20520
This commit is contained in:
parent
00e9d0241c
commit
774cf6fbc8
@ -138,19 +138,20 @@ std::vector<BOM_FIELD> FIELDS_EDITOR_GRID_DATA_MODEL::GetFieldsOrdered()
|
|||||||
|
|
||||||
void FIELDS_EDITOR_GRID_DATA_MODEL::SetFieldsOrder( const std::vector<wxString>& aNewOrder )
|
void FIELDS_EDITOR_GRID_DATA_MODEL::SetFieldsOrder( const std::vector<wxString>& aNewOrder )
|
||||||
{
|
{
|
||||||
if( aNewOrder.size() == m_cols.size() )
|
|
||||||
{
|
|
||||||
size_t foundCount = 0;
|
size_t foundCount = 0;
|
||||||
|
|
||||||
for( const wxString& newField : aNewOrder )
|
for( const wxString& newField : aNewOrder )
|
||||||
{
|
{
|
||||||
for( DATA_MODEL_COL& col : m_cols)
|
if( foundCount >= m_cols.size() )
|
||||||
|
break;
|
||||||
|
|
||||||
|
for( DATA_MODEL_COL& col : m_cols )
|
||||||
{
|
{
|
||||||
if( col.m_fieldName == newField )
|
if( col.m_fieldName == newField )
|
||||||
{
|
{
|
||||||
std::swap( m_cols[foundCount], col );
|
std::swap( m_cols[foundCount], col );
|
||||||
foundCount++;
|
foundCount++;
|
||||||
}
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user