From 6a638e0f789809e23a31ece7b8a10aa85592624a Mon Sep 17 00:00:00 2001 From: MrFry Date: Thu, 9 Apr 2020 22:24:08 +0200 Subject: [PATCH] Last info JSON parsing error handling --- stable.user.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/stable.user.js b/stable.user.js index f7c348d..08fe24c 100755 --- a/stable.user.js +++ b/stable.user.js @@ -21,7 +21,7 @@ // ==UserScript== // @name Moodle/Elearning/KMOOC test help -// @version 2.0.1.1 +// @version 2.0.1.2 // @description Online Moodle/Elearning/KMOOC test help // @author MrFry // @match https://elearning.uni-obuda.hu/main/* @@ -1716,7 +1716,11 @@ setVal('lastInfoCheckTime', now) } - const lastInfo = JSON.parse(getVal('lastInfo')) + let lastInfo = { result: 'noLastInfo' } + try { + lastInfo = JSON.parse(getVal('lastInfo')) + } catch (e) { + } if (lastInfo.result !== 'success' || now > lastCheck + (infoExpireTime * 1000)) { return new Promise((resolve, reject) => { const url = apiAdress +