Eeschema: fix partial schematic load bug in the legacy plugin.

Move the hierarchical sheet loading outside of the try exception block
so that any sheets that were loaded when a schematic file load fails
are loaded rather than skipped.  This allows more of the schematic to
be loaded when any parser errors occur.

(cherry picked from commit 1a8082c6d6)
This commit is contained in:
Wayne Stambaugh 2020-04-26 15:46:53 -04:00
parent 3f717f3baf
commit f61c692929
1 changed files with 22 additions and 22 deletions

View File

@ -687,6 +687,19 @@ void SCH_LEGACY_PLUGIN::loadHierarchy( SCH_SHEET* aSheet )
try try
{ {
loadFile( fileName.GetFullPath(), aSheet->GetScreen() ); loadFile( fileName.GetFullPath(), aSheet->GetScreen() );
}
catch( const IO_ERROR& ioe )
{
// If there is a problem loading the root sheet, there is no recovery.
if( aSheet == m_rootSheet )
throw( ioe );
// For all subsheets, queue up the error message for the caller.
if( !m_error.IsEmpty() )
m_error += "\n";
m_error += ioe.What();
}
EDA_ITEM* item = aSheet->GetScreen()->GetDrawItems(); EDA_ITEM* item = aSheet->GetScreen()->GetDrawItems();
@ -710,19 +723,6 @@ void SCH_LEGACY_PLUGIN::loadHierarchy( SCH_SHEET* aSheet )
item = item->Next(); item = item->Next();
} }
} }
catch( const IO_ERROR& ioe )
{
// If there is a problem loading the root sheet, there is no recovery.
if( aSheet == m_rootSheet )
throw( ioe );
// For all subsheets, queue up the error message for the caller.
if( !m_error.IsEmpty() )
m_error += "\n";
m_error += ioe.What();
}
}
m_currentPath.pop(); m_currentPath.pop();
wxLogTrace( traceSchLegacyPlugin, "Restoring path \"%s\"", m_currentPath.top() ); wxLogTrace( traceSchLegacyPlugin, "Restoring path \"%s\"", m_currentPath.top() );