From a178de87443f7bdf3c616015a76e29ed4e899139 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 27 Feb 2022 08:38:19 +0100 Subject: [PATCH] FP editor: fix crash when trying to export a footprint to the board editor. --- pcbnew/footprint_libraries_utils.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pcbnew/footprint_libraries_utils.cpp b/pcbnew/footprint_libraries_utils.cpp index f08023374f..6074acb232 100644 --- a/pcbnew/footprint_libraries_utils.cpp +++ b/pcbnew/footprint_libraries_utils.cpp @@ -911,7 +911,10 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard( bool aAddNew ) return false; } - if( aAddNew && m_toolManager->GetTool()->PlacingFootprint() ) + TOOL_MANAGER* pcb_ToolManager = pcbframe ? pcbframe->GetToolManager() : nullptr; + + if( aAddNew && pcb_ToolManager + && pcb_ToolManager->GetTool()->PlacingFootprint() ) { DisplayError( this, _( "Previous footprint placement still in progress." ) ); return false; @@ -964,7 +967,7 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard( bool aAddNew ) commit.Push( wxT( "Insert footprint" ) ); pcbframe->Raise(); - m_toolManager->RunAction( PCB_ACTIONS::placeFootprint, true, newFootprint ); + pcb_ToolManager->RunAction( PCB_ACTIONS::placeFootprint, true, newFootprint ); } newFootprint->ClearFlags();