Don't save broken polygon

If a polygon has fewer than 3 points, it is invalid.  We need to
register this as failure, otherwise we save the formatting/closing
s-expr for the polygon without the actual polygon points. This breaks
the footprint and board.
This commit is contained in:
Seth Hillbrand 2018-04-02 10:02:47 -07:00
parent dd56f16776
commit 532bf09817
1 changed files with 13 additions and 0 deletions

View File

@ -892,6 +892,12 @@ void PCB_IO::format( DRAWSEGMENT* aSegment, int aNestLevel ) const
m_out->Print( 0, ")" );
}
else
{
wxFAIL_MSG( wxT( "Cannot format invalid polygon." ) );
return;
}
break;
case S_CURVE: // Bezier curve
@ -904,6 +910,7 @@ void PCB_IO::format( DRAWSEGMENT* aSegment, int aNestLevel ) const
default:
wxFAIL_MSG( wxT( "Cannot format invalid DRAWSEGMENT type." ) );
return;
};
formatLayer( aSegment );
@ -968,6 +975,11 @@ void PCB_IO::format( EDGE_MODULE* aModuleDrawing, int aNestLevel ) const
m_out->Print( 0, ")" );
}
else
{
wxFAIL_MSG( wxT( "Cannot format invalid polygon." ) );
return;
}
break;
case S_CURVE: // Bezier curve
@ -980,6 +992,7 @@ void PCB_IO::format( EDGE_MODULE* aModuleDrawing, int aNestLevel ) const
default:
wxFAIL_MSG( wxT( "Cannot format invalid DRAWSEGMENT type." ) );
return;
};
formatLayer( aModuleDrawing );