diff --git a/eeschema/symbol_editor/symbol_editor.cpp b/eeschema/symbol_editor/symbol_editor.cpp index 3ddb1c8641..aa6753f522 100644 --- a/eeschema/symbol_editor/symbol_editor.cpp +++ b/eeschema/symbol_editor/symbol_editor.cpp @@ -828,8 +828,7 @@ void SYMBOL_EDIT_FRAME::CopySymbolToClipboard() void SYMBOL_EDIT_FRAME::DuplicateSymbol( bool aFromClipboard ) { - int dummyUnit; - LIB_ID libId = m_treePane->GetLibTree()->GetSelectedLibId( &dummyUnit ); + LIB_ID libId = GetTargetLibId(); wxString lib = libId.GetLibNickname(); if( !m_libMgr->LibraryExists( lib ) ) diff --git a/eeschema/tools/symbol_editor_control.cpp b/eeschema/tools/symbol_editor_control.cpp index 81c72318b2..c2d16ed797 100644 --- a/eeschema/tools/symbol_editor_control.cpp +++ b/eeschema/tools/symbol_editor_control.cpp @@ -160,7 +160,7 @@ int SYMBOL_EDITOR_CONTROL::AddSymbol( const TOOL_EVENT& aEvent ) if( libName.IsEmpty() ) { - msg.Printf( _( "No symbol library selected." ), libName ); + msg.Printf( _( "No symbol library selected." ) ); m_frame->ShowInfoBarError( msg ); return 0; } @@ -255,10 +255,17 @@ int SYMBOL_EDITOR_CONTROL::DuplicateSymbol( const TOOL_EVENT& aEvent ) if( m_frame->IsType( FRAME_SCH_SYMBOL_EDITOR ) ) { SYMBOL_EDIT_FRAME* editFrame = static_cast( m_frame ); + LIB_ID sel = editFrame->GetTargetLibId(); + wxString msg; + + if( !sel.IsValid() ) + { + msg.Printf( _( "No symbol selected" ) ); + m_frame->ShowInfoBarError( msg ); + return 0; + } - LIB_ID sel = editFrame->GetTreeLIBID(); const wxString& libName = sel.GetLibNickname(); - wxString msg; if( editFrame->GetLibManager().IsLibraryReadOnly( libName ) ) {