Adjust iterator after erasing an element

This commit is contained in:
Maciej Suminski 2016-08-10 12:17:56 +02:00
parent b6edf613dd
commit 0aad86435f
1 changed files with 5 additions and 4 deletions

View File

@ -247,19 +247,20 @@ static int find_vias_and_tracks_at( TRACKS& at_next, TRACKS& in_net, LSET& lset,
int track_count = 0;
// with expanded lset, find all tracks with an end on any of the layers in lset
for( TRACKS::iterator it = in_net.begin(); it != in_net.end(); )
for( TRACKS::iterator it = in_net.begin(); it != in_net.end(); /* iterates in the loop body */ )
{
TRACK* t = *it;
if( (t->GetLayerSet() & lset).any() &&
( t->GetStart() == next || t->GetEnd() == next ) )
if( ( t->GetLayerSet() & lset ).any() && ( t->GetStart() == next || t->GetEnd() == next ) )
{
at_next.push_back( t );
in_net.erase( it );
it = in_net.erase( it );
++track_count;
}
else
{
++it;
}
}
return track_count;