Symbol Editor IO_ERROR catching

Tests for read-only in table save routines and catches other IO_ERRORS.

Still returns a non-specific error message but prevents crashing when
erroring during save.

Fixes https://gitlab.com/kicad/code/kicad/issues/7352
This commit is contained in:
Seth Hillbrand 2021-01-31 11:29:58 -08:00
parent f908547141
commit 2edcf42115
1 changed files with 11 additions and 1 deletions

View File

@ -384,6 +384,9 @@ SYMBOL_LIB_TABLE::SAVE_T SYMBOL_LIB_TABLE::SaveSymbol( const wxString& aNickname
const SYMBOL_LIB_TABLE_ROW* row = FindRow( aNickname, true );
wxCHECK( row && row->plugin, SAVE_SKIPPED );
if( !row->plugin->IsSymbolLibWritable( row->GetFullURI( true ) ) )
return SAVE_SKIPPED;
if( !aOverwrite )
{
// Try loading the footprint to see if it already exists, caller wants overwrite
@ -399,7 +402,14 @@ SYMBOL_LIB_TABLE::SAVE_T SYMBOL_LIB_TABLE::SaveSymbol( const wxString& aNickname
return SAVE_SKIPPED;
}
row->plugin->SaveSymbol( row->GetFullURI( true ), aSymbol, row->GetProperties() );
try
{
row->plugin->SaveSymbol( row->GetFullURI( true ), aSymbol, row->GetProperties() );
}
catch( const IO_ERROR& ioe )
{
return SAVE_SKIPPED;
}
return SAVE_OK;
}