When failing to import, ensure extant screen

We need at least the root screen in order to handle any action in
Eeschema.  Because this is destroyed by starting to load the new
schematic, when failing, we need to reset to null.

This is not as good as resetting to the previous state but that will
take refactoring our file load routines in schematic editor

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16993
This commit is contained in:
Seth Hillbrand 2024-03-01 18:48:14 +00:00
parent 8d19d27483
commit 0d03f2febc
1 changed files with 2 additions and 0 deletions

View File

@ -777,6 +777,8 @@ void SCH_EDIT_FRAME::OnImportProject( wxCommandEvent& aEvent )
if( pluginType == SCH_IO_MGR::SCH_FILE_T::SCH_FILE_UNKNOWN )
{
wxLogError( _( "No loader can read the specified file: '%s'." ), fn.GetFullPath() );
CreateScreens();
SetScreen( Schematic().RootScreen() );
return;
}