pcbnew: prevent assert with first pt
Finding the pt-to-end intersection requires a segment, so check for multiple points. Fixes: lp:1846431 * https://bugs.launchpad.net/kicad/+bug/1846431
This commit is contained in:
parent
846397c692
commit
70c64d93e4
|
@ -152,11 +152,14 @@ void POLYGON_GEOM_MANAGER::updateLeaderPoints( const VECTOR2I& aEndPoint, LEADER
|
|||
const VECTOR2I lineVector( aEndPoint - lastPt );
|
||||
// get a restricted 45/H/V line from the last fixed point to the cursor
|
||||
auto newEnd = lastPt + GetVectorSnapped45( lineVector );
|
||||
OPT_VECTOR2I pt;
|
||||
|
||||
if( m_lockedPoints.SegmentCount() >0 )
|
||||
{
|
||||
SEG first( lastPt, newEnd );
|
||||
SEG test_seg = m_lockedPoints.CSegment( 0 );
|
||||
|
||||
auto pt = first.IntersectLines( m_lockedPoints.CSegment( 0 ) );
|
||||
pt = first.IntersectLines( m_lockedPoints.CSegment( 0 ) );
|
||||
int dist = pt ? ( aEndPoint - *pt ).EuclideanNorm() : std::numeric_limits<int>::max();
|
||||
|
||||
for( int i = 1; i < 8; i++ )
|
||||
|
@ -173,6 +176,7 @@ void POLYGON_GEOM_MANAGER::updateLeaderPoints( const VECTOR2I& aEndPoint, LEADER
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_leaderPts = SHAPE_LINE_CHAIN( lastPt, newEnd );
|
||||
|
||||
|
|
Loading…
Reference in New Issue