aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStuart Langridge <sil@kryogenix.org>2019-06-04 14:38:48 +0100
committerStuart Langridge <sil@kryogenix.org>2019-06-04 14:38:48 +0100
commitd671c148fe001f1f995908f9023e2efa43cbbf0f (patch)
tree221cb05c8399bcf8a787e8934d6a506915db9e36
parentreadme: Markup install steps as bash. (diff)
downloadmagnus-d671c148fe001f1f995908f9023e2efa43cbbf0f.tar.gz
magnus-d671c148fe001f1f995908f9023e2efa43cbbf0f.tar.bz2
magnus-d671c148fe001f1f995908f9023e2efa43cbbf0f.zip
Don't explode if the settings file is somehow invalid (fixes #3)
-rwxr-xr-xmagnus6
1 files changed, 5 insertions, 1 deletions
diff --git a/magnus b/magnus
index f05d02d..47dbba9 100755
--- a/magnus
+++ b/magnus
@@ -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
bgstack15