pcbnew_scripting_helpers: fix a potential crash when running a script outside kicad.

BOARD* LoadBoard( wxString& aFileName, IO_MGR::PCB_FILE_T aFormat ) crashes if a
old project file (*.pro) exists and the *.kicad_pro file doses not exists.
The crash happens when trying to convert the old config outside kicad.
This commit is contained in:
jean-pierre charras 2022-03-05 18:26:33 +01:00
parent cc5493e91e
commit 69453964b4
1 changed files with 5 additions and 2 deletions

View File

@ -141,8 +141,11 @@ BOARD* LoadBoard( wxString& aFileName, IO_MGR::PCB_FILE_T aFormat )
if( !project )
{
GetSettingsManager()->LoadProject( projectPath, false );
project = GetSettingsManager()->GetProject( projectPath );
if( wxFileExists( projectPath ) )
{
GetSettingsManager()->LoadProject( projectPath, false );
project = GetSettingsManager()->GetProject( projectPath );
}
}
else if( s_PcbEditFrame && project == &GetSettingsManager()->Prj() )
{