From 10954f3fece309eb492741e2e6aaaefa682ef0ed Mon Sep 17 00:00:00 2001 From: Quentin DECAUNES Date: Tue, 6 Aug 2019 17:26:31 +0200 Subject: [PATCH] fix: Avoid error when gitlab release api won't return a good response. --- js/methods.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/js/methods.js b/js/methods.js index 180d16b..84bb7b5 100644 --- a/js/methods.js +++ b/js/methods.js @@ -558,7 +558,13 @@ function checkForNewRelease() { request.onload = function() { if (this.status >= 200 && this.status < 400) { - var resp = JSON.parse(this.response); + var resp = {}; + try { + resp = JSON.parse(this.response); + } catch (error) { + console.log('WARNING: unable to check if a new version is available.', error); + return; + } if (resp[0].tag_name !== version) { notification('primary', "A new vesion is available, please check the release tab."); }