Drop invalid arcs on footprint load

In the case where the footprint arc has a non-normal angle, we cannot
represent this in pcbnew and it corrupts the gerber output.  Therefore
we drop the invalid arc and continue to load the footprint/board.

Fixes #3918 | https://gitlab.com/kicad/code/kicad/issues/3918

(cherry picked from commit 3e0ff72720)
This commit is contained in:
Seth Hillbrand 2020-02-28 14:36:56 -08:00
parent 100bb7c6ca
commit fd81f70355
1 changed files with 58 additions and 42 deletions

View File

@ -2142,6 +2142,20 @@ MODULE* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments )
break;
case T_fp_arc:
{
EDGE_MODULE* em = parseEDGE_MODULE();
// Drop 0 and NaN angles as these can corrupt/crash the schematic
if( std::isnormal( em->GetAngle() ) )
{
em->SetParent( module.get() );
em->SetDrawCoord();
module->GraphicalItemsList().PushBack( em );
}
}
break;
case T_fp_circle:
case T_fp_curve:
case T_fp_line:
@ -2150,8 +2164,9 @@ MODULE* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments )
EDGE_MODULE* em = parseEDGE_MODULE();
em->SetParent( module.get() );
em->SetDrawCoord();
module->GraphicalItemsList().PushBack( em );
module->Add( em );
}
break;
case T_pad:
@ -2163,6 +2178,7 @@ MODULE* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments )
pad->SetPosition( pt + module->GetPosition() );
module->Add( pad, ADD_APPEND );
}
break;
case T_model: