From f6eadbd1c900b5f779ebbf3c539192cd3c2b98cc Mon Sep 17 00:00:00 2001 From: "jeremy@jermolene.com" Date: Wed, 22 Sep 2021 12:56:55 +0100 Subject: [PATCH] Fix crash with reading invalid JSON files --- boot/boot.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/boot/boot.js b/boot/boot.js index ed8da06d1..9a0af66e2 100644 --- a/boot/boot.js +++ b/boot/boot.js @@ -1622,7 +1622,12 @@ $tw.modules.define("$:/boot/tiddlerdeserializer/json","tiddlerdeserializer",{ } return true; }, - data = JSON.parse(text); + data = {}; + try { + data = JSON.parse(text); + } catch(e) { + // Ignore JSON parse errors + } if($tw.utils.isArray(data) && isTiddlerArrayValid(data)) { return data; } else if(isTiddlerValid(data)) {