Browse Source

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
pull/15/head
Seth Hillbrand 7 years ago
parent
commit
8cc3c6f159
  1. 4
      include/geometry/shape_poly_set.h

4
include/geometry/shape_poly_set.h

@ -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() ) );
}
/**

Loading…
Cancel
Save