From 22009eb469336e0b8ec0fd71145af6f4851ce0fb Mon Sep 17 00:00:00 2001 From: Max Metz Date: Mon, 12 Aug 2024 19:56:26 +0200 Subject: [PATCH] resolving an issue where missing values for 'flags' in the Shipcall would cause rule-violations --- src/server/BreCal/validators/validation_base_utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/server/BreCal/validators/validation_base_utils.py b/src/server/BreCal/validators/validation_base_utils.py index f00bf10..e2aad61 100644 --- a/src/server/BreCal/validators/validation_base_utils.py +++ b/src/server/BreCal/validators/validation_base_utils.py @@ -18,6 +18,9 @@ def check_if_string_has_special_characters(text:typing.Optional[str]): def check_if_int_is_valid_flag(value, enum_object): + if value is None: # when no value is provided, the value is considered valid. + return False + # e.g., when an IntFlag has the values 1,2,4; the maximum valid value is 7 max_int = sum([int(val) for val in list(enum_object._value2member_map_.values())]) return 0 < value <= max_int