Avoid None returned when loading fitness file

main
Bob Mottram 2022-09-24 17:33:23 +01:00
parent 9ef2a22b7a
commit 6fb410276c
2 changed files with 5 additions and 1 deletions

View File

@ -21029,7 +21029,9 @@ def run_daemon(map_format: str,
fitness_filename = base_dir + '/accounts/fitness.json'
httpd.fitness = {}
if os.path.isfile(fitness_filename):
httpd.fitness = load_json(fitness_filename)
fitness = load_json(fitness_filename)
if fitness is not None:
httpd.fitness = fitness
# initialize authorized fetch key
httpd.signing_priv_key_pem = None

View File

@ -20,6 +20,8 @@ def fitness_performance(startTime, fitness_state: {},
debug: bool) -> None:
"""Log a performance watchpoint
"""
if fitness_state is None:
return
if 'performance' not in fitness_state:
fitness_state['performance'] = {}
if fitness_id not in fitness_state['performance']: