Fix schematic editor crash when exporting symbols to missing library.

UI string was reused from the symbol library manager.  No new translatable
strings were used.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16446
This commit is contained in:
Wayne Stambaugh 2023-12-26 12:49:34 -05:00
parent 81cec494f2
commit 20ee45edbe
1 changed files with 15 additions and 2 deletions

View File

@ -337,7 +337,8 @@ void SCH_EDITOR_CONTROL::doCrossProbeSchToPcb( const TOOL_EVENT& aEvent, bool aF
int SCH_EDITOR_CONTROL::ExportSymbolsToLibrary( const TOOL_EVENT& aEvent )
{
bool savePowerSymbols = IsOK( m_frame, _( "Include power symbols in schematic to the library?" ) );
bool savePowerSymbols = IsOK( m_frame,
_( "Include power symbols in schematic to the library?" ) );
bool createNew = aEvent.IsAction( &EE_ACTIONS::exportSymbolsToNewLibrary );
@ -430,7 +431,19 @@ int SCH_EDITOR_CONTROL::ExportSymbolsToLibrary( const TOOL_EVENT& aEvent )
LIB_SYMBOL* origSym = it.second;
LIB_SYMBOL* newSym = origSym->Flatten().release();
try
{
pi->SaveSymbol( dest.GetFullPath(), newSym );
}
catch( const IO_ERROR& ioe )
{
wxString msg;
msg.Printf( _( "Error saving symbol %s to library '%s'." ),
newSym->GetName(), row->GetNickName() );
msg += wxS( "\n\n" ) + ioe.What();
wxLogWarning( msg );
return 0;
}
if( map )
{