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

in fields, if no footprint defined for the symbol.
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 368233d6d7
commit d02ca968d1
1 changed files with 10 additions and 2 deletions

View File

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