Prevent iteration over empty polygon

When utilizing the standard iterator container, we may have polygons
with an empty outline (these are generated by gerbview to pcbnew).  This
should register as the end of the iterator to prevent dereferencing
This commit is contained in:
Seth Hillbrand 2019-04-16 17:26:58 -07:00
parent ead5bfe64b
commit 8cc3c6f159
1 changed files with 3 additions and 1 deletions

View File

@ -165,7 +165,9 @@ class SHAPE_POLY_SET : public SHAPE
operator bool() const
{
return m_currentPolygon <= m_lastPolygon;
return ( ( m_currentPolygon < m_lastPolygon ) ||
( m_currentPolygon == m_lastPolygon &&
m_currentVertex < m_poly->CPolygon( m_currentPolygon )[0].PointCount() ) );
}
/**