Add check if message_list is empty before entering for loop.
This commit is contained in:
parent
8c79991ae7
commit
8c4bb4e452
|
@ -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!")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue