diff --git a/web/app.py b/web/app.py index 9b37947..b646406 100644 --- a/web/app.py +++ b/web/app.py @@ -64,7 +64,11 @@ def create_app() -> flask.Flask: if not os.path.exists('data/tos.json'): open('data/tos.json', 'w', encoding='utf8').write('{}') - data = json.load(open('data/tos.json', encoding='utf8')) + try: + data = json.load(open('data/tos.json', encoding='utf8')) + except json.decoder.JSONDecodeError: + data = {} + data[code] = emoji json.dump(data, open('data/tos.json', 'w', encoding='utf8'))