Default to target lib when no lib tree sel exists.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17808
This commit is contained in:
Jeff Young 2024-04-22 17:36:24 +01:00
parent e8be782687
commit f51d227dc7
1 changed files with 3 additions and 3 deletions

View File

@ -192,8 +192,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() )
@ -216,7 +216,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 ) )
{