Nullptr safety. (Sentry KICAD-5N)

This commit is contained in:
Jeff Young 2023-01-18 01:05:27 +00:00
parent 47d88c5647
commit f90b04c715
1 changed files with 25 additions and 22 deletions

View File

@ -935,32 +935,35 @@ static void CreateSignalsSection( FILE* aFile, BOARD* aPcb )
{
net = aPcb->FindNet( ii );
if( net->GetNetname() == wxEmptyString ) // dummy netlist (no connection)
if( net )
{
msg.Printf( wxT( "NoConnection%d" ), NbNoConn++ );
}
if( net->GetNetCode() <= 0 ) // dummy netlist (no connection)
continue;
msg = wxT( "SIGNAL \"" ) + escapeString( net->GetNetname() ) + wxT( "\"" );
fputs( TO_UTF8( msg ), aFile );
fputs( "\n", aFile );
for( FOOTPRINT* footprint : aPcb->Footprints() )
{
for( PAD* pad : footprint->Pads() )
if( net->GetNetname() == wxEmptyString ) // dummy netlist (no connection)
{
if( pad->GetNetCode() != net->GetNetCode() )
continue;
msg.Printf( wxT( "NoConnection%d" ), NbNoConn++ );
}
msg.Printf( wxT( "NODE \"%s\" \"%s\"" ),
escapeString( footprint->GetReference() ),
escapeString( pad->GetNumber() ) );
if( net->GetNetCode() <= 0 ) // dummy netlist (no connection)
continue;
fputs( TO_UTF8( msg ), aFile );
fputs( "\n", aFile );
msg = wxT( "SIGNAL \"" ) + escapeString( net->GetNetname() ) + wxT( "\"" );
fputs( TO_UTF8( msg ), aFile );
fputs( "\n", aFile );
for( FOOTPRINT* footprint : aPcb->Footprints() )
{
for( PAD* pad : footprint->Pads() )
{
if( pad->GetNetCode() != net->GetNetCode() )
continue;
msg.Printf( wxT( "NODE \"%s\" \"%s\"" ),
escapeString( footprint->GetReference() ),
escapeString( pad->GetNumber() ) );
fputs( TO_UTF8( msg ), aFile );
fputs( "\n", aFile );
}
}
}
}