Skip to content

Commit

Permalink
fix(check_order_number): catch system exceptions
Browse files Browse the repository at this point in the history
When empty board is used, pcbnew.GetBoard().GetFileName() returns
FileNotFound exception which was not handled in check_order_number
function.

Signed-off-by: Andrej Valek <[email protected]>
  • Loading branch information
andy9a9 committed Nov 26, 2024
1 parent 35479b9 commit 709309a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -804,9 +804,13 @@ def select_part(self, *_):

def check_order_number(self):
"""Verify that the JLC order number placeholder is present."""
with open(self.pcbnew.GetBoard().GetFileName()) as f:
data = f.read()
return "JLCJLCJLCJLC" in data
try:
with open(self.pcbnew.GetBoard().GetFileName()) as f:
data = f.read()
return "JLCJLCJLCJLC" in data
except OSError:
pass
return True

def generate_fabrication_data(self, *_):
"""Generate fabrication data."""
Expand Down

0 comments on commit 709309a

Please sign in to comment.