diff options
author | Stuart Langridge <sil@kryogenix.org> | 2019-06-04 14:38:48 +0100 |
---|---|---|
committer | Stuart Langridge <sil@kryogenix.org> | 2019-06-04 14:38:48 +0100 |
commit | d671c148fe001f1f995908f9023e2efa43cbbf0f (patch) | |
tree | 221cb05c8399bcf8a787e8934d6a506915db9e36 | |
parent | readme: Markup install steps as bash. (diff) | |
download | magnus-d671c148fe001f1f995908f9023e2efa43cbbf0f.tar.gz magnus-d671c148fe001f1f995908f9023e2efa43cbbf0f.tar.bz2 magnus-d671c148fe001f1f995908f9023e2efa43cbbf0f.zip |
Don't explode if the settings file is somehow invalid (fixes #3)
-rwxr-xr-x | magnus | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -224,7 +224,11 @@ class Main(object): print("couldn't restore settings (error: %s), so assuming they're blank" % (e,)) contents = "{}" # fake contents - data = json.loads(contents) + try: + data = json.loads(contents) + except Exception as e: + print("Warning: settings file seemed to be invalid json (error: %s), so assuming blank" % (e,)) + data = {} zl = data.get("zoom") if zl: idx = 0 |