From 0b3e5952b71feb0b3d41c4656811c1713e2ce721 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 6 Mar 2017 21:30:51 +0100 Subject: [PATCH] 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 --- eeschema/files-io.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/eeschema/files-io.cpp b/eeschema/files-io.cpp index d40a924feb..8cb5a6f9f4 100644 --- a/eeschema/files-io.cpp +++ b/eeschema/files-io.cpp @@ -320,6 +320,11 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector& aFileSet, in } 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; msg.Printf( _( "Error loading schematic file '%s'.\n%s" ), GetChars( fullFileName ), GetChars( ioe.What() ) ); @@ -328,10 +333,6 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector& aFileSet, in msg.Printf( _( "Failed to load '%s'" ), GetChars( fullFileName ) ); AppendMsgPanel( wxEmptyString, msg, CYAN ); - // When g_RootSheet is NULL, create a dummy root sheet and screen. - CreateScreens(); - Zoom_Automatique( false ); - return false; }