From f942b4c657865066268a149c1e87c637bca9f630 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Thu, 23 Feb 2023 16:56:47 +0000 Subject: [PATCH] Don't allow extra text in Sim.* fields. (In particular, the field name.) Fixes https://gitlab.com/kicad/code/kicad/issues/13996 (cherry picked from commit 71df3f9edb6c9f3a760cd06eb52cdbdd012fc028) --- eeschema/sim/sim_model.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/eeschema/sim/sim_model.cpp b/eeschema/sim/sim_model.cpp index 3222bb2b19..74686286ac 100644 --- a/eeschema/sim/sim_model.cpp +++ b/eeschema/sim/sim_model.cpp @@ -620,7 +620,10 @@ std::string SIM_MODEL::GetFieldValue( const std::vector* 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 ) ) {