diff --git a/pcbnew/router/pns_node.cpp b/pcbnew/router/pns_node.cpp index 691a3d4d90..154376af90 100644 --- a/pcbnew/router/pns_node.cpp +++ b/pcbnew/router/pns_node.cpp @@ -1051,6 +1051,10 @@ const LINE NODE::AssembleLine( LINKED_ITEM* aSeg, int* aOriginSegmentIndex, // Remove duplicate verts, but do NOT remove colinear segments here! pl.Line().Simplify( false ); + // TODO: maintain actual segment index under simplifcation system + if( aOriginSegmentIndex && *aOriginSegmentIndex >= pl.SegmentCount() ) + *aOriginSegmentIndex = pl.SegmentCount() - 1; + assert( pl.SegmentCount() != 0 ); return pl;