Skip to content

Commit

Permalink
Fix segfault on BOARDs without tracks.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Steinberg authored and Wayne Stambaugh committed Aug 3, 2016
1 parent 021320b commit 32f2428
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions pcbnew/zones_polygons_test_connections.cpp
Expand Up @@ -143,15 +143,19 @@ void BOARD::Test_Connections_To_Copper_Areas( int aNetcode )
for( unsigned ii = 0; ii < net->m_PadInNetList.size(); ii++ )
candidates.push_back( net->m_PadInNetList[ii] );

// Build the list of track candidates connected to the net:
TRACK* track = m_Track.GetFirst()->GetStartNetCode( netcode );

for( ; track; track = track->Next() )
// If we have any tracks...
if( m_Track.GetCount() > 0 )
{
if( track->GetNetCode() != netcode )
break;
// Build the list of track candidates connected to the net:
TRACK* track = m_Track.GetFirst()->GetStartNetCode( netcode );

for( ; track; track = track->Next() )
{
if( track->GetNetCode() != netcode )
break;

candidates.push_back( track );
candidates.push_back( track );
}
}
}

Expand Down Expand Up @@ -307,12 +311,18 @@ void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb, int aNetcode )

// Build the list of track candidates connected to the net:
TRACK* track;
track = aPcb->m_Track.GetFirst()->GetStartNetCode( aNetcode );
for( ; track; track = track->Next() )

if( aPcb->m_Track.GetCount() > 0 )
{
if( track->GetNetCode() != aNetcode )
break;
Candidates.push_back( track );
track = aPcb->m_Track.GetFirst()->GetStartNetCode( aNetcode );

for( ; track; track = track->Next() )
{
if( track->GetNetCode() != aNetcode )
break;

Candidates.push_back( track );
}
}

if( Candidates.size() == 0 )
Expand Down

0 comments on commit 32f2428

Please sign in to comment.