From 40526ed012f6522e474e597d95befec165314d7a Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Mon, 5 Sep 2022 10:30:29 -0300 Subject: [PATCH] [Fixed] Avoid reloading the project is none loaded --- kibot/pre_set_text_variables.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/kibot/pre_set_text_variables.py b/kibot/pre_set_text_variables.py index 571d2d97..8043b164 100644 --- a/kibot/pre_set_text_variables.py +++ b/kibot/pre_set_text_variables.py @@ -148,9 +148,10 @@ class Set_Text_Variables(BasePreFlight): # noqa: F821 GS.make_bkp(pro_name) with open(pro_name, 'wt') as f: f.write(json.dumps(data, sort_keys=True, indent=2)) - # Force a project reload - sm = pcbnew.GetSettingsManager() - sm.UnloadProject(GS.board.GetProject(), False) - assert sm.LoadProject(pro_name) - # Force the PCB reload (will reload the project file) - GS.board = None + if GS.board: + # Force a project reload + sm = pcbnew.GetSettingsManager() + sm.UnloadProject(GS.board.GetProject(), False) + assert sm.LoadProject(pro_name) + # Force the PCB reload (will reload the project file) + GS.board = None