diff --git a/eeschema/symbol_editor/symbol_library_manager.cpp b/eeschema/symbol_editor/symbol_library_manager.cpp index a239f61abc..27b010f5b9 100644 --- a/eeschema/symbol_editor/symbol_library_manager.cpp +++ b/eeschema/symbol_editor/symbol_library_manager.cpp @@ -973,11 +973,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() ) @@ -1071,8 +1083,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() )