2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

f18.js: check JSON via try and not via eval

git-svn-id: https://svn.fhem.de/fhem/trunk@16206 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2018-02-17 19:52:00 +00:00
parent 9d621ca4bb
commit 8853265e49

View File

@ -1,7 +1,7 @@
"use strict";
FW_version["f18.js"] = "$Id$";
// TODO: hierMenu,absPos,floorplan,f18style.css
// TODO: hierMenu,absPos,floorplan,f18style.css,menuBorder,SVGcolors,PWA:push
var f18_attr, f18_aCol, f18_sd, f18_isMobile, f18_icon={}, f18_hasPos, f18_room;
var f18_small = (screen.width < 480 || screen.height < 480);
@ -267,8 +267,9 @@ f18_special()
appendTo = "table#f18tr";
addRow("room", "Target", '<select><option>all</option></select>');
FW_cmd(FW_root+"?cmd=JsonList2 .* room&XHR=1", function(data) {
var d = eval("JSON.parse(data);");
FW_cmd(FW_root+"?cmd=jsonlist2 .* room&XHR=1", function(data) {
var d;
try { d=JSON.parse(data); } catch(e){ log(data); return FW_okDialog(e); }
for(var i1=0; i1<d.Results.length; i1++) {
var rname = d.Results[i1].Attributes.room;
if(!rname || rname == "hidden")