From e64b356d93cce7189d40639cc4c5f255bbfdbfc8 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 27 Dec 2022 14:57:30 +0000 Subject: [PATCH] Fix broken if/then/else logic. Fixes https://gitlab.com/kicad/code/kicad/issues/13192 --- .../sch_plugins/kicad/sch_sexpr_parser.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp b/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp index 6f873461e4..49dc7c44b3 100644 --- a/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp +++ b/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp @@ -3839,19 +3839,19 @@ SCH_TEXT* SCH_SEXPR_PARSER::parseSchText() SCH_FIELD* field = parseSchField( text.get() ); - if( text->Type() == SCH_GLOBAL_LABEL_T ) + // If the field is a Intersheetrefs it is not handled like other fields: + // It always exists and is the first in list + if( text->Type() == SCH_GLOBAL_LABEL_T + && ( field->GetInternalName() == wxT( "Intersheet References" ) // old name in V6.0 + || field->GetInternalName() == wxT( "Intersheetrefs" ) ) ) // Current name { - // If the field is a Intersheetrefs it is not handled like other fields: - // It always exists and is the first in list - if( field->GetInternalName() == wxT( "Intersheetrefs") || // Current name - field->GetInternalName() == wxT( "Intersheet References") ) // old name in V6.0 - { - SCH_GLOBALLABEL* label = static_cast( text.get() ); - label->GetFields()[0] = *field; - } + SCH_GLOBALLABEL* label = static_cast( text.get() ); + label->GetFields()[0] = *field; } else + { static_cast( text.get() )->GetFields().emplace_back( *field ); + } delete field; break;