Add checks against missing D-Codes in flashed Gerber items

Fixes: lp:1756710
* https://bugs.launchpad.net/kicad/+bug/1756710
This commit is contained in:
Jon Evans 2018-03-18 21:55:07 -04:00
parent aa0ae48dda
commit 4e76a18d5d
2 changed files with 26 additions and 11 deletions

View File

@ -320,37 +320,49 @@ const EDA_RECT GERBER_DRAW_ITEM::GetBoundingBox() const
case GBR_SPOT_CIRCLE:
{
int radius = code->m_Size.x >> 1;
bbox.Inflate( radius, radius );
if( code )
{
int radius = code->m_Size.x >> 1;
bbox.Inflate( radius, radius );
}
break;
}
case GBR_SPOT_RECT:
{
bbox.Inflate( code->m_Size.x / 2, code->m_Size.y / 2 );
if( code )
bbox.Inflate( code->m_Size.x / 2, code->m_Size.y / 2 );
break;
}
case GBR_SPOT_OVAL:
{
bbox.Inflate( code->m_Size.x, code->m_Size.y );
if( code )
bbox.Inflate( code->m_Size.x, code->m_Size.y );
break;
}
case GBR_SPOT_POLY:
{
if( code->m_Polygon.OutlineCount() == 0 )
code->ConvertShapeToPolygon();
if( code )
{
if( code->m_Polygon.OutlineCount() == 0 )
code->ConvertShapeToPolygon();
bbox.Inflate( code->m_Polygon.BBox().GetWidth() / 2, code->m_Polygon.BBox().GetHeight() / 2 );
bbox.Inflate( code->m_Polygon.BBox().GetWidth() / 2,
code->m_Polygon.BBox().GetHeight() / 2 );
}
break;
}
case GBR_SPOT_MACRO:
{
// Update the shape drawings and the bounding box coordiantes:
code->GetMacro()->GetApertureMacroShape( this, m_Start );
// now the bounding box is valid:
bbox = code->GetMacro()->GetBoundingBox();
if( code )
{
// Update the shape drawings and the bounding box coordiantes:
code->GetMacro()->GetApertureMacroShape( this, m_Start );
// now the bounding box is valid:
bbox = code->GetMacro()->GetBoundingBox();
}
break;
}

View File

@ -406,6 +406,9 @@ void GERBVIEW_PAINTER::drawFlashedShape( GERBER_DRAW_ITEM* aItem, bool aFilled )
wxASSERT_MSG( code, wxT( "drawFlashedShape: Item has no D_CODE!" ) );
if( !code )
return;
m_gal->SetIsFill( aFilled );
m_gal->SetIsStroke( !aFilled );
m_gal->SetLineWidth( m_gerbviewSettings.m_outlineWidth );