Don't try and select if we don't have a location.

Fixes https://gitlab.com/kicad/code/kicad/issues/5088
This commit is contained in:
Jeff Young 2020-08-05 23:39:54 +01:00
parent 6a4f611e61
commit 4b51184678
1 changed files with 8 additions and 2 deletions

View File

@ -58,11 +58,17 @@ bool GLOBAL_EDIT_TOOL::Init()
int GLOBAL_EDIT_TOOL::ExchangeFootprints( const TOOL_EVENT& aEvent )
{
PCBNEW_SELECTION& selection = m_selectionTool->RequestSelection( EDIT_TOOL::FootprintFilter );
MODULE* mod = (selection.Empty() ? nullptr : selection.FirstOfKind<MODULE> () );
PCBNEW_SELECTION& selection = m_selectionTool->GetSelection();
MODULE* mod = nullptr;
bool updateMode = false;
bool currentMode = false;
if( aEvent.HasPosition() )
selection = m_selectionTool->RequestSelection( EDIT_TOOL::FootprintFilter );
if( !selection.Empty() )
mod = selection.FirstOfKind<MODULE>();
if( aEvent.IsAction( &PCB_ACTIONS::updateFootprint ) )
{
updateMode = true;