fixes Coverity issue 109780 in project_rescue.cpp: an uncaught exception on load or save of the project library list

This commit is contained in:
unknown 2015-08-10 09:39:13 +02:00 committed by jean-pierre charras
parent ef2e05c8d7
commit 140d17bf82
1 changed files with 15 additions and 7 deletions

View File

@ -101,6 +101,8 @@ static bool insert_library( PROJECT *aProject, PART_LIB *aLibrary, size_t aIndex
aProject->SetElem( PROJECT::ELEM_SCH_PART_LIBS, libs ); aProject->SetElem( PROJECT::ELEM_SCH_PART_LIBS, libs );
} }
try
{
PART_LIBS::LibNamesAndPaths( aProject, false, &libPaths, &libNames ); PART_LIBS::LibNamesAndPaths( aProject, false, &libPaths, &libNames );
// Make sure the library is not already in the list // Make sure the library is not already in the list
@ -110,6 +112,12 @@ static bool insert_library( PROJECT *aProject, PART_LIB *aLibrary, size_t aIndex
// Add the library to the list and save // Add the library to the list and save
libNames.Insert( libName, aIndex ); libNames.Insert( libName, aIndex );
PART_LIBS::LibNamesAndPaths( aProject, true, &libPaths, &libNames ); PART_LIBS::LibNamesAndPaths( aProject, true, &libPaths, &libNames );
}
catch( const IO_ERROR& e )
{
// Could not get or save the current libraries.
return false;
}
// Save the old libraries in case there is a problem after clear(). We'll // Save the old libraries in case there is a problem after clear(). We'll
// put them back in. // put them back in.