[AutoTool] Fix error handling for ccw=None

This commit is contained in:
Jan Petykiewicz 2026-02-15 01:15:07 -08:00
commit 66d6fae2bd

View file

@ -590,6 +590,13 @@ class AutoTool(Tool, metaclass=ABCMeta):
) -> tuple[Port, LData]: ) -> tuple[Port, LData]:
success = False success = False
# Initialize these to avoid UnboundLocalError in the error message
bend_dxy, bend_angle = numpy.zeros(2), pi
itrans_dxy = numpy.zeros(2)
otrans_dxy = numpy.zeros(2)
btrans_dxy = numpy.zeros(2)
for straight in self.straights: for straight in self.straights:
for bend in self.bends: for bend in self.bends:
bend_dxy, bend_angle = self._bend2dxy(bend, ccw) bend_dxy, bend_angle = self._bend2dxy(bend, ccw)