Eeschema: fix segfault when auto save file is detected.

Fixes https://gitlab.com/kicad/code/kicad/issues/5068
This commit is contained in:
Wayne Stambaugh 2020-09-01 10:29:06 -04:00
parent c30dc04571
commit 673677c831
1 changed files with 3 additions and 3 deletions

View File

@ -284,14 +284,14 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
} }
else else
{ {
// This will rename the file if there is an autosave and the user want to recover
CheckForAutoSaveFile( fullFileName );
SetScreen( nullptr ); SetScreen( nullptr );
delete g_RootSheet; // Delete the current project. delete g_RootSheet; // Delete the current project.
g_RootSheet = NULL; // Force CreateScreens() to build new empty project on load failure. g_RootSheet = NULL; // Force CreateScreens() to build new empty project on load failure.
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_LEGACY ) ); SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_LEGACY ) );
// This will rename the file if there is an autosave and the user want to recover
CheckForAutoSaveFile( fullFileName );
try try
{ {
g_RootSheet = pi->Load( fullFileName, &Kiway() ); g_RootSheet = pi->Load( fullFileName, &Kiway() );