diff --git a/eeschema/symbol_editor/symbol_library_manager.cpp b/eeschema/symbol_editor/symbol_library_manager.cpp index 2f615529cc..00791ec327 100644 --- a/eeschema/symbol_editor/symbol_library_manager.cpp +++ b/eeschema/symbol_editor/symbol_library_manager.cpp @@ -959,11 +959,23 @@ bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer( std::shared_ptrGetName() != originalSymbol->GetName() ) { - if( aLibTable->LoadSymbol( m_libName, originalSymbol->GetName() ) ) - aLibTable->DeleteSymbol( m_libName, originalSymbol->GetName() ); + // DeleteSymbol may throw + try + { + if( aLibTable->LoadSymbol( m_libName, originalSymbol->GetName() ) ) + aLibTable->DeleteSymbol( m_libName, originalSymbol->GetName() ); + } + catch( const IO_ERROR& ioe ) + { + wxLogError( errorMsg, UnescapeString( originalSymbol->GetName() ), m_libName, + ioe.What() ); + return false; + } } if( libSymbol->IsAlias() ) @@ -1054,8 +1066,17 @@ bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer( std::shared_ptrGetName() != originalSymbol->GetName() ) { - if( aPlugin->LoadSymbol( aFileName, originalSymbol->GetName() ) ) - aPlugin->DeleteSymbol( aFileName, originalSymbol->GetName(), &properties ); + try + { + if( aPlugin->LoadSymbol( aFileName, originalSymbol->GetName() ) ) + aPlugin->DeleteSymbol( aFileName, originalSymbol->GetName(), &properties ); + } + catch( const IO_ERROR& ioe ) + { + wxLogError( errorMsg, UnescapeString( originalSymbol->GetName() ), aFileName, + ioe.What() ); + return false; + } } if( libSymbol->IsAlias() )