From 8c4bb4e4528ee8d34e85233bac1994f1f97b3916 Mon Sep 17 00:00:00 2001 From: Homer S Date: Wed, 30 Jun 2021 23:21:43 +0200 Subject: [PATCH] Add check if message_list is empty before entering for loop. --- fritzab2matrix.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/fritzab2matrix.py b/fritzab2matrix.py index 78128fa..2b1d3cf 100755 --- a/fritzab2matrix.py +++ b/fritzab2matrix.py @@ -64,6 +64,8 @@ def main(): return messages l = get_message_list(message_list_url) + if l['Root'] == None: + return False for a in l['Root']['Message']: @@ -124,15 +126,14 @@ def main(): if __name__ == "__main__": - try: - print("I enter the main loop ...") - while main(): - pass - else: - print("I left the main loop!") + + print("I enter the main loop ...") + while main(): + pass + else: + print("I left the main loop!") - except: - print("An erroneous error happened!") +