Commit 41397f5b authored by Maciej Suminski's avatar Maciej Suminski

Fixes ratsnest crashing on zones with negative net codes.

parent 9413b305
...@@ -801,26 +801,40 @@ void RN_DATA::ProcessBoard() ...@@ -801,26 +801,40 @@ void RN_DATA::ProcessBoard()
{ {
m_nets.clear(); m_nets.clear();
m_nets.resize( m_board->GetNetCount() ); m_nets.resize( m_board->GetNetCount() );
int netCode;
// Iterate over all items that may need to be connected // Iterate over all items that may need to be connected
for( MODULE* module = m_board->m_Modules; module; module = module->Next() ) for( MODULE* module = m_board->m_Modules; module; module = module->Next() )
{ {
for( D_PAD* pad = module->Pads().GetFirst(); pad; pad = pad->Next() ) for( D_PAD* pad = module->Pads().GetFirst(); pad; pad = pad->Next() )
m_nets[pad->GetNet()].AddItem( pad ); {
netCode = pad->GetNet();
if( netCode > 0 )
m_nets[netCode].AddItem( pad );
}
} }
for( TRACK* track = m_board->m_Track; track; track = track->Next() ) for( TRACK* track = m_board->m_Track; track; track = track->Next() )
{ {
if( track->Type() == PCB_VIA_T ) netCode = track->GetNet();
m_nets[track->GetNet()].AddItem( static_cast<SEGVIA*>( track ) );
else if( track->Type() == PCB_TRACE_T ) if( netCode > 0 )
m_nets[track->GetNet()].AddItem( track ); {
if( track->Type() == PCB_VIA_T )
m_nets[netCode].AddItem( static_cast<SEGVIA*>( track ) );
else if( track->Type() == PCB_TRACE_T )
m_nets[netCode].AddItem( track );
}
} }
for( int i = 0; i < m_board->GetAreaCount(); ++i ) for( int i = 0; i < m_board->GetAreaCount(); ++i )
{ {
ZONE_CONTAINER* zone = m_board->GetArea( i ); ZONE_CONTAINER* zone = m_board->GetArea( i );
m_nets[zone->GetNet()].AddItem( zone ); netCode = zone->GetNet();
if( netCode > 0 )
m_nets[netCode].AddItem( zone );
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment