Gracefully handle DNP & Excl-from-brd components in nets list.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/17146
This commit is contained in:
parent
4596a11da2
commit
9be60cb45d
|
@ -183,7 +183,6 @@ void KICAD_NETLIST_PARSER::parseNet()
|
||||||
* (node (ref "U9") (pin "M6") (pin_function "reset")))
|
* (node (ref "U9") (pin "M6") (pin_function "reset")))
|
||||||
*/
|
*/
|
||||||
|
|
||||||
COMPONENT* component = NULL;
|
|
||||||
wxString code;
|
wxString code;
|
||||||
wxString name;
|
wxString name;
|
||||||
wxString reference;
|
wxString reference;
|
||||||
|
@ -257,25 +256,18 @@ void KICAD_NETLIST_PARSER::parseNet()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( strtol( code.c_str(), NULL, 10 ) >= 1 )
|
// Don't assume component will be found; it might be "DNP" or "Exclude from board".
|
||||||
|
if( COMPONENT* component = m_netlist->GetComponentByReference( reference ) )
|
||||||
|
{
|
||||||
|
if( strtol( code.c_str(), nullptr, 10 ) >= 1 )
|
||||||
{
|
{
|
||||||
if( name.IsEmpty() ) // Give a dummy net name like N-000009
|
if( name.IsEmpty() ) // Give a dummy net name like N-000009
|
||||||
name = wxT("N-00000") + code;
|
name = wxT("N-00000") + code;
|
||||||
|
|
||||||
component = m_netlist->GetComponentByReference( reference );
|
|
||||||
|
|
||||||
// Cannot happen if the netlist is valid.
|
|
||||||
if( component == NULL )
|
|
||||||
{
|
|
||||||
wxString msg;
|
|
||||||
msg.Printf( _( "Cannot find component with ref '%s' in netlist." ),
|
|
||||||
reference );
|
|
||||||
THROW_PARSE_ERROR( msg, m_lineReader->GetSource(), m_lineReader->Line(),
|
|
||||||
m_lineReader->LineNumber(), m_lineReader->Length() );
|
|
||||||
}
|
|
||||||
|
|
||||||
component->AddNet( pin_number, name, pin_function, pin_type );
|
component->AddNet( pin_number, name, pin_function, pin_type );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue