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
(cherry picked from commit 586fddeec1
)
This commit is contained in:
parent
1264230973
commit
625d241adf
|
@ -877,6 +877,10 @@ bool LINE_PLACER::splitHeadTail( const LINE& aNewLine, const LINE& aOldTail, LIN
|
||||||
if( !found )
|
if( !found )
|
||||||
i--;
|
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();
|
newHead.Clear();
|
||||||
|
|
||||||
if( i == 0 )
|
if( i == 0 )
|
||||||
|
|
Loading…
Reference in New Issue