From b127fd1d63c05bf939a6eefb4dc59ccdd9077afb Mon Sep 17 00:00:00 2001 From: Roel Walraven Date: Fri, 24 Feb 2017 14:09:37 +0100 Subject: [PATCH] Add !== undefined check on update checking --- src/LightDMMock.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/LightDMMock.js b/src/LightDMMock.js index 0a78896..85afd72 100644 --- a/src/LightDMMock.js +++ b/src/LightDMMock.js @@ -504,11 +504,13 @@ window.checkForUpdate = function(currentVersion) { switch(request.status) { case 200: try { - var latest = JSON.parse(request.responseText).tag_name; + var latest; - if(currentVersion !== latest) { + if(request.responseText !== undefined) + latest = JSON.parse(request.responseText).tag_name; + + if(currentVersion !== latest) window.console.warn("You are using an outdated version of LightDMMock. Please download the new version from https://github.com/CytoDev/LightDMMock/releases/" + latest); - } } catch(e) { window.console.error(e.toString()); window.console.warn("Could not check for new version of LightDMMock. Please check for a new version manually by visiting https://github.com/CytoDev/LightDMMock/releases/latest");