SYMBOL_EDITOR_CONTROL::DuplicateSymbol(): fix incorrect validation test.

DuplicateSymbol() is called both to duplicate and paste. Only duplicate
needs a test to know if a symbol is selected.
Fixes #11053
https://gitlab.com/kicad/code/kicad/issues/11053
This commit is contained in:
jean-pierre charras 2022-04-01 10:42:20 +02:00
parent d5de4bb5c7
commit 39959844e5
1 changed files with 6 additions and 2 deletions

View File

@ -256,10 +256,14 @@ int SYMBOL_EDITOR_CONTROL::DuplicateSymbol( const TOOL_EVENT& aEvent )
{
SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
LIB_ID sel = editFrame->GetTargetLibId();
// DuplicateSymbol() is called to duplicate a symbol, or to paste a previously
// saved symbol in clipboard
bool isPasteAction = aEvent.IsAction( &EE_ACTIONS::pasteSymbol );
wxString msg;
if( !sel.IsValid() )
if( !sel.IsValid() && !isPasteAction )
{
// When duplicating a symbol, a source symbol must exists.
msg.Printf( _( "No symbol selected" ) );
m_frame->ShowInfoBarError( msg );
return 0;
@ -274,7 +278,7 @@ int SYMBOL_EDITOR_CONTROL::DuplicateSymbol( const TOOL_EVENT& aEvent )
return 0;
}
editFrame->DuplicateSymbol( aEvent.IsAction( &EE_ACTIONS::pasteSymbol ) );
editFrame->DuplicateSymbol( isPasteAction );
}
return 0;