SHAPE_POLY_SET: avoid invalid polygon

Ensures the polygon index is never used unless it exists in the vector
This commit is contained in:
Seth Hillbrand 2019-04-28 14:09:46 -07:00
parent a5a2152ff4
commit c343b36a39
1 changed files with 3 additions and 3 deletions

View File

@ -165,9 +165,9 @@ class SHAPE_POLY_SET : public SHAPE
operator bool() const
{
return ( ( m_currentPolygon < m_lastPolygon ) || ( IsLastPolygon() &&
( m_currentContour < static_cast<int>( m_poly->CPolygon( m_currentPolygon ).size() ) ||
( IsEndContour() && m_currentVertex < m_poly->CPolygon( m_currentPolygon )[m_currentContour].PointCount() )
return ( ( m_currentPolygon < m_lastPolygon ) || ( m_currentPolygon == m_poly->OutlineCount() - 1 &&
( m_currentContour < static_cast<int>( m_poly->CPolygon( m_currentPolygon ).size() ) - 1 ||
( m_currentVertex < m_poly->CPolygon( m_currentPolygon )[m_currentContour].PointCount() )
)
) );
}