Don't allow extra text in Sim.* fields.

(In particular, the field name.)

Fixes https://gitlab.com/kicad/code/kicad/issues/13996
This commit is contained in:
Jeff Young 2023-02-23 16:56:47 +00:00
parent 150d2fd281
commit 71df3f9edb
1 changed files with 5 additions and 2 deletions

View File

@ -620,7 +620,10 @@ std::string SIM_MODEL::GetFieldValue( const std::vector<T>* aFields, const wxStr
for( const T& field : *aFields )
{
if( field.GetName() == aFieldName )
return aResolve ? field.GetShownText().ToStdString() : field.GetText().ToStdString();
{
return aResolve ? field.GetShownText( 0, false ).ToStdString()
: field.GetText().ToStdString();
}
}
return "";
@ -1424,7 +1427,7 @@ void SIM_MODEL::MigrateSimModel( T_symbol& aSymbol, const PROJECT* aProject )
// SPICE. Here we remap them to 'r0' and 'r1'.
if( T_field* deviceType = aSymbol.FindField( SIM_TYPE_FIELD ) )
{
if( deviceType->GetShownText().Lower() == wxS( "pot" ) )
if( deviceType->GetShownText( 0, false ).Lower() == wxS( "pot" ) )
{
if( T_field* pins = aSymbol.FindField( SIM_PINS_FIELD ) )
{