From 8d46ed3c7283f909811cacf7b3507e6063e199b4 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 30 Jun 2023 17:51:03 +0200 Subject: [PATCH] PCad importer: fix segfault in PCAD2KICAD::PCAD_ARC::AddToBoard Fixes #15086 https://gitlab.com/kicad/code/kicad/-/issues/15086 --- pcbnew/plugins/pcad/pcad_arc.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pcbnew/plugins/pcad/pcad_arc.cpp b/pcbnew/plugins/pcad/pcad_arc.cpp index 212ad2a1d5..c372b811bc 100644 --- a/pcbnew/plugins/pcad/pcad_arc.cpp +++ b/pcbnew/plugins/pcad/pcad_arc.cpp @@ -175,7 +175,6 @@ void PCAD_ARC::Flip() void PCAD_ARC::AddToBoard( FOOTPRINT* aFootprint ) { 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->SetStart( VECTOR2I( m_StartX, m_StartY ) ); @@ -186,9 +185,12 @@ void PCAD_ARC::AddToBoard( FOOTPRINT* aFootprint ) if( aFootprint ) { + aFootprint->Add( arc ); arc->Rotate( { 0, 0 }, aFootprint->GetOrientation() ); arc->Move( aFootprint->GetPosition() ); } + else + m_board->Add( arc ); }