Avoid trying to draw empty pads.

Fixes https://gitlab.com/kicad/code/kicad/issues/12605

(cherry picked from commit e866dfe137)
This commit is contained in:
Jeff Young 2022-10-09 20:23:38 +01:00
parent 6003097411
commit 3213ea582d
2 changed files with 7 additions and 2 deletions

View File

@ -273,7 +273,7 @@ void CornerListToPolygon( SHAPE_POLY_SET& outline, std::vector<ROUNDED_CORNER>&
endAngle = RAD2DECIDEG( angle );
}
if( aInflate )
if( aInflate && tanAngle2 )
{
radius += aInflate;
cornerPosition += incoming.Resize( aInflate / tanAngle2 )

View File

@ -1247,6 +1247,9 @@ void PCB_PAINTER::draw( const PAD* aPad, int aLayer )
{
const SHAPE_SIMPLE* poly = static_cast<const SHAPE_SIMPLE*>( shape );
if( poly->PointCount() < 2 ) // Careful of empty pads
break;
if( margin.x < 0 ) // The poly shape must be deflated
{
int numSegs = GetArcToSegmentCount( -margin.x, m_maxError, 360.0 );
@ -1347,7 +1350,9 @@ void PCB_PAINTER::draw( const PAD* aPad, int aLayer )
// Use ERROR_INSIDE because it avoids Clipper and is therefore much faster.
aPad->TransformShapeWithClearanceToPolygon( polySet, ToLAYER_ID( aLayer ),
clearance, m_maxError, ERROR_INSIDE );
m_gal->DrawPolygon( polySet );
if( polySet.Outline( 0 ).PointCount() > 2 ) // Careful of empty pads
m_gal->DrawPolygon( polySet );
}
}
else if( aPad->GetEffectiveHoleShape() && clearance > 0 )