PCad importer: fix segfault in PCAD2KICAD::PCAD_ARC::AddToBoard

Fixes #15086
https://gitlab.com/kicad/code/kicad/-/issues/15086
This commit is contained in:
jean-pierre charras 2023-06-30 17:51:03 +02:00
parent dd83217062
commit 8d46ed3c72
1 changed files with 3 additions and 1 deletions

View File

@ -175,7 +175,6 @@ void PCAD_ARC::Flip()
void PCAD_ARC::AddToBoard( FOOTPRINT* aFootprint ) void PCAD_ARC::AddToBoard( FOOTPRINT* aFootprint )
{ {
PCB_SHAPE* arc = new PCB_SHAPE( aFootprint, IsCircle() ? SHAPE_T::CIRCLE : SHAPE_T::ARC ); PCB_SHAPE* arc = new PCB_SHAPE( aFootprint, IsCircle() ? SHAPE_T::CIRCLE : SHAPE_T::ARC );
aFootprint->Add( arc );
arc->SetCenter( VECTOR2I( m_PositionX, m_PositionY ) ); arc->SetCenter( VECTOR2I( m_PositionX, m_PositionY ) );
arc->SetStart( VECTOR2I( m_StartX, m_StartY ) ); arc->SetStart( VECTOR2I( m_StartX, m_StartY ) );
@ -186,9 +185,12 @@ void PCAD_ARC::AddToBoard( FOOTPRINT* aFootprint )
if( aFootprint ) if( aFootprint )
{ {
aFootprint->Add( arc );
arc->Rotate( { 0, 0 }, aFootprint->GetOrientation() ); arc->Rotate( { 0, 0 }, aFootprint->GetOrientation() );
arc->Move( aFootprint->GetPosition() ); arc->Move( aFootprint->GetPosition() );
} }
else
m_board->Add( arc );
} }