diff --git a/masque/builder/tools.py b/masque/builder/tools.py index 6bd7547..4162be3 100644 --- a/masque/builder/tools.py +++ b/masque/builder/tools.py @@ -590,6 +590,13 @@ class AutoTool(Tool, metaclass=ABCMeta): ) -> tuple[Port, LData]: 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 bend in self.bends: bend_dxy, bend_angle = self._bend2dxy(bend, ccw)