Add check if message_list is empty before entering for loop.

This commit is contained in:
Homer S. 2021-06-30 23:21:43 +02:00
parent 8c79991ae7
commit 8c4bb4e452
1 changed files with 9 additions and 8 deletions

View File

@ -64,6 +64,8 @@ def main():
return messages return messages
l = get_message_list(message_list_url) l = get_message_list(message_list_url)
if l['Root'] == None:
return False
for a in l['Root']['Message']: for a in l['Root']['Message']:
@ -124,15 +126,14 @@ def main():
if __name__ == "__main__": if __name__ == "__main__":
try:
print("I enter the main loop ...")
while main():
pass
else:
print("I left the main loop!")
except: print("I enter the main loop ...")
print("An erroneous error happened!") while main():
pass
else:
print("I left the main loop!")