Fix bad field names when ID == -1.
Fixes https://gitlab.com/kicad/code/kicad/issues/10548
This commit is contained in:
parent
7ed569058c
commit
3d0b03515d
|
@ -788,7 +788,7 @@ wxString SCH_FIELD::GetName( bool aUseDefaultName ) const
|
|||
|
||||
if( m_parent && m_parent->Type() == SCH_SYMBOL_T )
|
||||
{
|
||||
if( m_id < MANDATORY_FIELDS )
|
||||
if( m_id >= 0 && m_id < MANDATORY_FIELDS )
|
||||
return TEMPLATE_FIELDNAME::GetDefaultFieldName( m_id );
|
||||
else if( m_name.IsEmpty() && aUseDefaultName )
|
||||
return TEMPLATE_FIELDNAME::GetDefaultFieldName( m_id );
|
||||
|
@ -797,7 +797,7 @@ wxString SCH_FIELD::GetName( bool aUseDefaultName ) const
|
|||
}
|
||||
else if( m_parent && m_parent->Type() == SCH_SHEET_T )
|
||||
{
|
||||
if( m_id < SHEET_MANDATORY_FIELDS )
|
||||
if( m_id >= 0 && m_id < SHEET_MANDATORY_FIELDS )
|
||||
return SCH_SHEET::GetDefaultFieldName( m_id );
|
||||
else if( m_name.IsEmpty() && aUseDefaultName )
|
||||
return SCH_SHEET::GetDefaultFieldName( m_id );
|
||||
|
|
Loading…
Reference in New Issue