7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-11 14:50:11 +00:00

Don't presume there are at least two footprint text

defaults.

Yes, we ship that way, but a user could delete one
or edit their json file.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20398
This commit is contained in:
Jeff Young 2025-03-31 15:34:32 +01:00
parent 14ca6e7b08
commit 9b71102dd8

View File

@ -224,7 +224,7 @@ void PANEL_FP_EDITOR_FIELD_DEFAULTS::loadFPSettings( const FOOTPRINT_EDITOR_SETT
table->DeleteRows( 0, m_fieldPropsGrid->GetNumberRows() );
table->AppendRows( 2 );
for( int i : { 0, 1 } )
for( int i = 0; i < std::min<int>( 2, (int) aCfg->m_DesignSettings.m_DefaultFPTextItems.size() ); ++i )
{
TEXT_ITEM_INFO item = aCfg->m_DesignSettings.m_DefaultFPTextItems[i];
@ -238,7 +238,7 @@ void PANEL_FP_EDITOR_FIELD_DEFAULTS::loadFPSettings( const FOOTPRINT_EDITOR_SETT
// if aCfg->m_DesignSettings.m_DefaultFPTextItems.size() is > 2 (first and second are ref and
// value), some extra texts must be added to the list of default texts
int extra_texts_cnt = aCfg->m_DesignSettings.m_DefaultFPTextItems.size() - 2;
int extra_texts_cnt = (int) aCfg->m_DesignSettings.m_DefaultFPTextItems.size() - 2;
if( extra_texts_cnt > 0 )
table->AppendRows( extra_texts_cnt );