fix the bug with format time for real

ice_status['connectivity']['remainingTimeSeconds'] might be None
This commit is contained in:
Von Birne 2021-12-07 20:31:15 +01:00
parent a4d873becd
commit 05636a6568

View file

@ -8,6 +8,8 @@ from sys import exit
# bundlewrap.utils.text.format_duration, but trimmed down
def format_time(seconds):
if seconds is None:
return "?"
components = []
if seconds >= 3600:
hours = int(seconds / 3600)
@ -67,7 +69,7 @@ try:
ice_status['speed'],
next_stop,
ice_status['connectivity']['currentState'],
format_time(int(ice_status['connectivity']['remainingTimeSeconds'])),
format_time(ice_status['connectivity']['remainingTimeSeconds']),
ice_status['connectivity']['nextState'],
))
except Exception as e: