Eeschema: fix crash if using ${FOOTPRINT_NAME} or ${FOOTPRINT_LIBRARY} as values

in fields, if no footprint defined for the symbol.
From master branch
Fixes #15676
https://gitlab.com/kicad/code/kicad/-/issues/15676
This commit is contained in:
jean-pierre charras 2023-09-18 09:12:12 +02:00
parent 0c9eda44d4
commit 48189172ea
1 changed files with 10 additions and 2 deletions

View File

@ -1221,7 +1221,11 @@ bool SCH_SYMBOL::ResolveTextVar( wxString* token, int aDepth, const SCH_SHEET_PA
wxArrayString parts = wxSplit( footprint, ':' );
*token = parts[ 0 ];
if( parts.Count() > 0 )
*token = parts[ 0 ];
else
*token = wxEmptyString;
return true;
}
else if( token->IsSameAs( wxT( "FOOTPRINT_NAME" ) ) )
@ -1232,7 +1236,11 @@ bool SCH_SYMBOL::ResolveTextVar( wxString* token, int aDepth, const SCH_SHEET_PA
wxArrayString parts = wxSplit( footprint, ':' );
*token = parts[ std::min( 1, (int) parts.size() - 1 ) ];
if( parts.Count() > 1 )
*token = parts[ std::min( 1, (int) parts.size() - 1 ) ];
else
*token = wxEmptyString;
return true;
}
else if( token->IsSameAs( wxT( "UNIT" ) ) )