Skip to content

Commit

Permalink
Catch KeyError if constraint name is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
isikhar committed Apr 26, 2023
1 parent e039a38 commit fa4398a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions diffcalc/hkl/you/constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,9 @@ def set_constraint(self, name, value): # @ReservedAssignment
return "%s : %s --> %s" % (name, old_str, new_str)

def get_constraint(self, name):
value = self.all[name]
try:
value = self.all[name]
except KeyError:
return None
return None if value is None else value * TODEG


0 comments on commit fa4398a

Please sign in to comment.