Avoid case where whole line is new head
If the whole line shifts, we may have no points of the old tail in the new line. In this case, we may not only not find the split point but we may also have fewer points in the new line than were in the old head. Clamping to the maximum potential point count prevents creating invalid lines Fixes https://gitlab.com/kicad/code/kicad/-/issues/16591
This commit is contained in:
parent
3435c6ebee
commit
586fddeec1
|
@ -877,6 +877,10 @@ bool LINE_PLACER::splitHeadTail( const LINE& aNewLine, const LINE& aOldTail, LIN
|
|||
if( !found )
|
||||
i--;
|
||||
|
||||
// If the old tail doesn't have any points of the new line, we can't split it.
|
||||
if( i >= l2.PointCount() )
|
||||
i = l2.PointCount() - 1;
|
||||
|
||||
newHead.Clear();
|
||||
|
||||
if( i == 0 )
|
||||
|
|
Loading…
Reference in New Issue