FP editor: fix crash when trying to export a footprint to the board editor.

From Master branch.
This commit is contained in:
jean-pierre charras 2022-02-27 08:38:19 +01:00
parent a8175f49a6
commit a91dd68444
1 changed files with 5 additions and 2 deletions

View File

@ -911,7 +911,10 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard( bool aAddNew )
return false; return false;
} }
if( aAddNew && m_toolManager->GetTool<BOARD_EDITOR_CONTROL>()->PlacingFootprint() ) TOOL_MANAGER* pcb_ToolManager = pcbframe ? pcbframe->GetToolManager() : nullptr;
if( aAddNew && pcb_ToolManager
&& pcb_ToolManager->GetTool<BOARD_EDITOR_CONTROL>()->PlacingFootprint() )
{ {
DisplayError( this, _( "Previous footprint placement still in progress." ) ); DisplayError( this, _( "Previous footprint placement still in progress." ) );
return false; return false;
@ -964,7 +967,7 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard( bool aAddNew )
commit.Push( wxT( "Insert footprint" ) ); commit.Push( wxT( "Insert footprint" ) );
pcbframe->Raise(); pcbframe->Raise();
m_toolManager->RunAction( PCB_ACTIONS::placeFootprint, true, newFootprint ); pcb_ToolManager->RunAction( PCB_ACTIONS::placeFootprint, true, newFootprint );
} }
newFootprint->ClearFlags(); newFootprint->ClearFlags();