Allow non-named tool in Remove()
The tool command string was optional and not set when calling Remove() through the Cut action. Referencing the value causes unhandled assertions. We don't actually need the value because we don't pop anything without a match. The empty string will not match Fixes https://gitlab.com/kicad/code/kicad/issues/12562
This commit is contained in:
parent
09960caa66
commit
981aafd5d9
|
@ -1799,8 +1799,13 @@ int EDIT_TOOL::Remove( const TOOL_EVENT& aEvent )
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string tool = aEvent.GetCommandStr().value();
|
std::string tool{};
|
||||||
|
|
||||||
|
if( aEvent.GetCommandStr() )
|
||||||
|
{
|
||||||
|
tool = aEvent.GetCommandStr().value();
|
||||||
editFrame->PushTool( tool );
|
editFrame->PushTool( tool );
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<BOARD_ITEM*> lockedItems;
|
std::vector<BOARD_ITEM*> lockedItems;
|
||||||
Activate();
|
Activate();
|
||||||
|
@ -2494,7 +2499,7 @@ int EDIT_TOOL::cutToClipboard( const TOOL_EVENT& aEvent )
|
||||||
// N.B. Setting the CUT flag prevents lock filtering as we only want to delete the items
|
// N.B. Setting the CUT flag prevents lock filtering as we only want to delete the items
|
||||||
// that were copied to the clipboard, no more, no fewer. Filtering for locked item, if
|
// that were copied to the clipboard, no more, no fewer. Filtering for locked item, if
|
||||||
// any will be done in the copyToClipboard() routine
|
// any will be done in the copyToClipboard() routine
|
||||||
TOOL_EVENT evt( aEvent.Category(), aEvent.Action(), TOOL_ACTION_SCOPE::AS_GLOBAL );
|
TOOL_EVENT evt( aEvent.Category(), aEvent.Action(), "Cut", TOOL_ACTION_SCOPE::AS_GLOBAL );
|
||||||
evt.SetParameter( PCB_ACTIONS::REMOVE_FLAGS::CUT );
|
evt.SetParameter( PCB_ACTIONS::REMOVE_FLAGS::CUT );
|
||||||
Remove( evt );
|
Remove( evt );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue