1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-29 21:09:56 +00:00

Fix crash with reading invalid JSON files

This commit is contained in:
jeremy@jermolene.com 2021-09-22 12:56:55 +01:00
parent bdbb884be0
commit f6eadbd1c9

View File

@ -1622,7 +1622,12 @@ $tw.modules.define("$:/boot/tiddlerdeserializer/json","tiddlerdeserializer",{
} }
return true; return true;
}, },
data = {};
try {
data = JSON.parse(text); data = JSON.parse(text);
} catch(e) {
// Ignore JSON parse errors
}
if($tw.utils.isArray(data) && isTiddlerArrayValid(data)) { if($tw.utils.isArray(data) && isTiddlerArrayValid(data)) {
return data; return data;
} else if(isTiddlerValid(data)) { } else if(isTiddlerValid(data)) {