From 6a1cb15114af581e3e215627ee9d894106a1c048 Mon Sep 17 00:00:00 2001 From: simon Date: Thu, 7 Apr 2022 23:02:07 +0700 Subject: [PATCH] validate hours to not be greater than 23, #209 --- tubearchivist/home/src/ta/config.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tubearchivist/home/src/ta/config.py b/tubearchivist/home/src/ta/config.py index 724e612..c89d62c 100644 --- a/tubearchivist/home/src/ta/config.py +++ b/tubearchivist/home/src/ta/config.py @@ -220,6 +220,10 @@ class ScheduleBuilder: raise ValueError("invalid input") to_write = dict(zip(keys, values)) + all_hours = [int(i) for i in re.split(r"\D+", to_write["hour"])] + if max(all_hours) > 23: + print("hour can't be greater than 23") + raise ValueError("invalid input") try: int(to_write["minute"]) except ValueError as error: