Pcbnew: avoid crash when saving a board having "orphan" nets.

Sometimes tracks or zones can have "orphan" nets no longer existing
in schematic after updating the board from the schematic (no pad belonging this net).

The fix does not save these broken nets having no info (no netname, no valid netcode)

Fixes #5087
https://gitlab.com/kicad/code/kicad/issues/5087
This commit is contained in:
jean-pierre charras 2020-08-06 16:11:55 +02:00
parent 27d319b2df
commit 5a33772f41
1 changed files with 3 additions and 0 deletions

View File

@ -579,6 +579,9 @@ void PCB_IO::formatNetInformation( BOARD* aBoard, int aNestLevel ) const
{
for( NETINFO_ITEM* net : *m_mapping )
{
if( net == nullptr ) // Skip not actually existing nets (orphan nets)
continue;
m_out->Print( aNestLevel, "(net %d %s)\n",
m_mapping->Translate( net->GetNet() ),
m_out->Quotew( net->GetNetname() ).c_str() );