Prevent drag index from exceeding full line count
Simplification removes segments, so we might lose our valid index. Ideally, we would simplify during the assembly or pass the input index to the simplify routine to maintain the proper value. Fixes https://gitlab.com/kicad/code/kicad/issues/12137
This commit is contained in:
parent
7f71eef45b
commit
6c617d84ca
|
@ -1051,6 +1051,10 @@ const LINE NODE::AssembleLine( LINKED_ITEM* aSeg, int* aOriginSegmentIndex,
|
||||||
// Remove duplicate verts, but do NOT remove colinear segments here!
|
// Remove duplicate verts, but do NOT remove colinear segments here!
|
||||||
pl.Line().Simplify( false );
|
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 );
|
assert( pl.SegmentCount() != 0 );
|
||||||
|
|
||||||
return pl;
|
return pl;
|
||||||
|
|
Loading…
Reference in New Issue