From d7651288eeeab92cd881ac5d9c3c34f5833f2d6d Mon Sep 17 00:00:00 2001 From: Generoso Martello Date: Thu, 25 Oct 2018 20:23:17 +0200 Subject: [PATCH] fix error occurring creating a new wizard script; fix energy monitor widget --- .../Common/html/pages/configure/programengine/_programslist.js | 3 ++- .../pages/control/widgets/homegenie/generic/energymonitor.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/BaseFiles/Common/html/pages/configure/programengine/_programslist.js b/BaseFiles/Common/html/pages/configure/programengine/_programslist.js index 99b71f255..4ac13fffa 100644 --- a/BaseFiles/Common/html/pages/configure/programengine/_programslist.js +++ b/BaseFiles/Common/html/pages/configure/programengine/_programslist.js @@ -634,7 +634,8 @@ HG.WebApp.ProgramsList = HG.WebApp.ProgramsList || new function () { var $$ = th editor3.markClean(); // if (program.Type.toLowerCase() === 'wizard') { - var script = JSON.parse(program.ScriptSource); + var script = {ConditionType: '', Conditions: [], Commands: []}; + try { script = JSON.parse(program.ScriptSource); } catch (e) { } currentProgram.ConditionType = script.ConditionType; currentProgram.Conditions = script.Conditions; currentProgram.Commands = script.Commands; diff --git a/BaseFiles/Common/html/pages/control/widgets/homegenie/generic/energymonitor.js b/BaseFiles/Common/html/pages/control/widgets/homegenie/generic/energymonitor.js index 2a804743e..15219ee37 100644 --- a/BaseFiles/Common/html/pages/control/widgets/homegenie/generic/energymonitor.js +++ b/BaseFiles/Common/html/pages/control/widgets/homegenie/generic/energymonitor.js @@ -123,7 +123,7 @@ function drawStats(mod) { type: 'GET', dataType: 'json', success: function (counterData) { - + if (counterData.History == null) return; var dataSerie = []; var yMin = 0; if (counterData.History.length > 0)