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:
Seth Hillbrand 2024-04-19 17:51:47 -07:00
parent 1264230973
commit 625d241adf
1 changed files with 4 additions and 0 deletions

View File

@ -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 )