Default to target lib when no lib tree sel exists.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17808

(cherry picked from commit f51d227dc7)
This commit is contained in:
Jeff Young 2024-04-22 17:36:24 +01:00
parent baaa8b6537
commit 67b5e86cc4
1 changed files with 3 additions and 3 deletions

View File

@ -172,8 +172,8 @@ int SYMBOL_EDITOR_CONTROL::AddSymbol( const TOOL_EVENT& aEvent )
{
SYMBOL_EDIT_FRAME* editFrame = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
LIB_ID sel = editFrame->GetTreeLIBID();
const wxString& libName = sel.GetLibNickname();
LIB_ID target = editFrame->GetTargetLibId();
const wxString& libName = target.GetLibNickname();
wxString msg;
if( libName.IsEmpty() )
@ -196,7 +196,7 @@ int SYMBOL_EDITOR_CONTROL::AddSymbol( const TOOL_EVENT& aEvent )
}
else if( aEvent.IsAction( &EE_ACTIONS::deriveFromExistingSymbol ) )
{
editFrame->CreateNewSymbol( sel.GetLibItemName() );
editFrame->CreateNewSymbol( target.GetLibItemName() );
}
else if( aEvent.IsAction( &EE_ACTIONS::importSymbol ) )
{