fix the bug with format time for real
ice_status['connectivity']['remainingTimeSeconds'] might be None
This commit is contained in:
parent
a4d873becd
commit
05636a6568
1 changed files with 3 additions and 1 deletions
|
@ -8,6 +8,8 @@ from sys import exit
|
||||||
|
|
||||||
# bundlewrap.utils.text.format_duration, but trimmed down
|
# bundlewrap.utils.text.format_duration, but trimmed down
|
||||||
def format_time(seconds):
|
def format_time(seconds):
|
||||||
|
if seconds is None:
|
||||||
|
return "?"
|
||||||
components = []
|
components = []
|
||||||
if seconds >= 3600:
|
if seconds >= 3600:
|
||||||
hours = int(seconds / 3600)
|
hours = int(seconds / 3600)
|
||||||
|
@ -67,7 +69,7 @@ try:
|
||||||
ice_status['speed'],
|
ice_status['speed'],
|
||||||
next_stop,
|
next_stop,
|
||||||
ice_status['connectivity']['currentState'],
|
ice_status['connectivity']['currentState'],
|
||||||
format_time(int(ice_status['connectivity']['remainingTimeSeconds'])),
|
format_time(ice_status['connectivity']['remainingTimeSeconds']),
|
||||||
ice_status['connectivity']['nextState'],
|
ice_status['connectivity']['nextState'],
|
||||||
))
|
))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
Loading…
Reference in a new issue