Browse Source

Restore bounds checking (even though its a performance hit).

revert-0c36e162
Jeff Young 8 months ago
parent
commit
ac265926b1
  1. 7
      libs/kimath/src/geometry/shape_line_chain.cpp

7
libs/kimath/src/geometry/shape_line_chain.cpp

@ -1258,8 +1258,13 @@ int SHAPE_LINE_CHAIN::ShapeCount() const
SEG SHAPE_LINE_CHAIN::Segment( int aIndex ) const
{
int segCount = SegmentCount();
if( aIndex < 0 )
aIndex += SegmentCount();
aIndex += segCount;
wxCHECK( aIndex < segCount && aIndex >= 0,
m_points.size() > 0 ? SEG( m_points.back(), m_points.back() ) : SEG( 0, 0, 0, 0 ) );
if( aIndex == (int) ( m_points.size() - 1 ) && m_closed )
return SEG( m_points[aIndex], m_points[0], aIndex );
Loading…
Cancel
Save