Prevent crash when a python script tries to use pcbnew too early.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15414
This commit is contained in:
Alex Shvartzkop
2023-08-25 00:09:56 +03:00
parent 16c35857bf
commit b1b66f66f4
3 changed files with 14 additions and 3 deletions
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 NBEE Embedded Systems, Miguel Angel Ajo <[email protected]>
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -77,6 +77,13 @@ void ScriptingSetPcbEditFrame( PCB_EDIT_FRAME* aPcbEditFrame )
}
void ScriptingOnDestructPcbEditFrame( PCB_EDIT_FRAME* aPcbEditFrame )
{
if( s_PcbEditFrame == aPcbEditFrame )
s_PcbEditFrame = nullptr;
}
BOARD* LoadBoard( wxString& aFileName )
{
if( aFileName.EndsWith( KiCadPcbFileExtension ) )