From 423785587add6a7afae36b251929ae4e2891db8e Mon Sep 17 00:00:00 2001 From: KaraMelih Date: Thu, 15 Aug 2024 11:33:22 -0500 Subject: [PATCH] pval is not a required arg, don't crash --- snews_pt/messages.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/snews_pt/messages.py b/snews_pt/messages.py index 7eaa8d8..2febc70 100644 --- a/snews_pt/messages.py +++ b/snews_pt/messages.py @@ -266,6 +266,9 @@ def is_valid(self): # p_val must be a float between 0 and 1 pv = self.message_data['p_val'] + if pv is None: + # it is not a required argument, check only if it is not None + return True if isinstance(pv, str): pv = float(pv) if not (0.0 <= pv <= 1.0): @@ -356,6 +359,9 @@ def is_valid(self): # p_val must be a float between 0 and 1 pv = self.message_data['p_val'] + if pv is None: + # it is not a required argument, check only if it is not None + return True if isinstance(pv, str): pv = float(pv) if not (0.0 <= pv <= 1.0):