Fix broken if/then/else logic.

Fixes https://gitlab.com/kicad/code/kicad/issues/13192
This commit is contained in:
Jeff Young 2022-12-27 14:57:30 +00:00
parent 1ad373f2b2
commit e64b356d93
1 changed files with 9 additions and 9 deletions

View File

@ -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<SCH_GLOBALLABEL*>( text.get() );
label->GetFields()[0] = *field;
}
SCH_GLOBALLABEL* label = static_cast<SCH_GLOBALLABEL*>( text.get() );
label->GetFields()[0] = *field;
}
else
{
static_cast<SCH_LABEL_BASE*>( text.get() )->GetFields().emplace_back( *field );
}
delete field;
break;