7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-11 10:00:13 +00:00

SHAPE_POLY_SET: Fix up non-closed outlines when added

This commit is contained in:
Jon Evans 2024-12-30 20:18:03 -05:00
parent dcf66a675a
commit a4ac22f2d6

View File

@ -546,12 +546,16 @@ bool SHAPE_POLY_SET::IsSelfIntersecting() const
int SHAPE_POLY_SET::AddOutline( const SHAPE_LINE_CHAIN& aOutline )
{
assert( aOutline.IsClosed() );
POLYGON poly;
poly.push_back( aOutline );
// This is an assertion because if it's generated by KiCad code, it probably
// indicates a bug elsewhere that should be fixed, but we also auto-fix it here
// for SWIG plugins that might mess it up
wxCHECK2_MSG( aOutline.IsClosed(), poly.back().SetClosed( true ),
"Warning: non-closed outline added to SHAPE_POLY_SET" );
m_polys.push_back( poly );
return m_polys.size() - 1;