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:
parent
ef2e05c8d7
commit
140d17bf82
|
@ -101,15 +101,23 @@ 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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
PART_LIBS::LibNamesAndPaths( aProject, false, &libPaths, &libNames );
|
try
|
||||||
|
{
|
||||||
|
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
|
||||||
while( libNames.Index( libName ) != wxNOT_FOUND )
|
while( libNames.Index( libName ) != wxNOT_FOUND )
|
||||||
libNames.Remove( libName );
|
libNames.Remove( libName );
|
||||||
|
|
||||||
// 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.
|
||||||
|
|
Loading…
Reference in New Issue