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 <andy@skyrain.eu>
  • Loading branch information
andy9a9 committed Nov 26, 2024
1 parent 35479b9 commit f32bd69
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -804,9 +804,14 @@ 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 f32bd69

Please sign in to comment.