Eeschema: fix a crash if a schematic project was not loaded due to a incorrect file format error (Linux only)

Fixes: lp:1670322
https://bugs.launchpad.net/kicad/+bug/1670322
This commit is contained in:
jean-pierre charras 2017-03-06 21:30:51 +01:00
parent f8415633bd
commit 0b3e5952b7
1 changed files with 5 additions and 4 deletions

View File

@ -320,6 +320,11 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
} }
catch( const IO_ERROR& ioe ) catch( const IO_ERROR& ioe )
{ {
// Do not leave g_RootSheet == NULL because it is expected to be
// a valid sheet. Therefore create a dummy empty root sheet and screen.
CreateScreens();
Zoom_Automatique( false );
wxString msg; wxString msg;
msg.Printf( _( "Error loading schematic file '%s'.\n%s" ), msg.Printf( _( "Error loading schematic file '%s'.\n%s" ),
GetChars( fullFileName ), GetChars( ioe.What() ) ); GetChars( fullFileName ), GetChars( ioe.What() ) );
@ -328,10 +333,6 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
msg.Printf( _( "Failed to load '%s'" ), GetChars( fullFileName ) ); msg.Printf( _( "Failed to load '%s'" ), GetChars( fullFileName ) );
AppendMsgPanel( wxEmptyString, msg, CYAN ); AppendMsgPanel( wxEmptyString, msg, CYAN );
// When g_RootSheet is NULL, create a dummy root sheet and screen.
CreateScreens();
Zoom_Automatique( false );
return false; return false;
} }