Fix segfault on BOARDs without tracks

This commit is contained in:
decimad 2016-08-03 10:20:52 +02:00 committed by Maciej Suminski
parent 18b7dbf4d1
commit 8dcf040a4e
1 changed files with 22 additions and 12 deletions

View File

@ -143,6 +143,9 @@ void BOARD::Test_Connections_To_Copper_Areas( int aNetcode )
for( unsigned ii = 0; ii < net->m_PadInNetList.size(); ii++ ) for( unsigned ii = 0; ii < net->m_PadInNetList.size(); ii++ )
candidates.push_back( net->m_PadInNetList[ii] ); candidates.push_back( net->m_PadInNetList[ii] );
// If we have any tracks...
if( m_Track.GetCount() > 0 )
{
// Build the list of track candidates connected to the net: // Build the list of track candidates connected to the net:
TRACK* track = m_Track.GetFirst()->GetStartNetCode( netcode ); TRACK* track = m_Track.GetFirst()->GetStartNetCode( netcode );
@ -154,6 +157,7 @@ void BOARD::Test_Connections_To_Copper_Areas( int aNetcode )
candidates.push_back( track ); candidates.push_back( track );
} }
} }
}
// test if a candidate is inside a filled area of this zone // test if a candidate is inside a filled area of this zone
const SHAPE_POLY_SET& polysList = zone->GetFilledPolysList(); const SHAPE_POLY_SET& polysList = zone->GetFilledPolysList();
@ -307,13 +311,19 @@ void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb, int aNetcode )
// Build the list of track candidates connected to the net: // Build the list of track candidates connected to the net:
TRACK* track; TRACK* track;
if( aPcb->m_Track.GetCount() > 0 )
{
track = aPcb->m_Track.GetFirst()->GetStartNetCode( aNetcode ); track = aPcb->m_Track.GetFirst()->GetStartNetCode( aNetcode );
for( ; track; track = track->Next() ) for( ; track; track = track->Next() )
{ {
if( track->GetNetCode() != aNetcode ) if( track->GetNetCode() != aNetcode )
break; break;
Candidates.push_back( track ); Candidates.push_back( track );
} }
}
if( Candidates.size() == 0 ) if( Candidates.size() == 0 )
return; return;