Address CodeQL findings

This commit is contained in:
LordGrey 2023-09-04 19:46:00 +02:00
parent bc8cecf19c
commit 661f222d28

View File

@ -1157,10 +1157,10 @@ function beginWizardHue() {
var h = (x + 1) / 2; var h = (x + 1) / 2;
var v = (-z + 1) / 2; var v = (-z + 1) / 2;
hmin = h - 0.05; var hmin = h - 0.05;
hmax = h + 0.05; var hmax = h + 0.05;
vmin = v - 0.05; var vmin = v - 0.05;
vmax = v + 0.05; var vmax = v + 0.05;
let layoutObject = { let layoutObject = {
hmin: hmin < 0 ? 0 : hmin, hmin: hmin < 0 ? 0 : hmin,
@ -1185,8 +1185,8 @@ function beginWizardHue() {
segTotalLength += segment[key].length; segTotalLength += segment[key].length;
} }
var min = 0; var min;
var max = 1; var max;
var horizontal = true; var horizontal = true;
var layoutObject = assignLightPos(position, name); var layoutObject = assignLightPos(position, name);
@ -1239,17 +1239,17 @@ function beginWizardHue() {
var lightName; var lightName;
if (isAPIv2Ready) { if (isAPIv2Ready) {
light = hueLights.find(light => light.id === lightId); var light = hueLights.find(light => light.id === lightId);
lightName = light.metadata.name; lightName = light.metadata.name;
} else { } else {
lightName = hueLights[lightId].name; lightName = hueLights[lightId].name;
} }
var position = $('#hue_' + lightId).val(); var position = $('#hue_' + lightId).val();
var lightIdx = groupLights.indexOf(lightId) var lightIdx = groupLights.indexOf(lightId);
var lightLocation = groupLightsLocations[lightIdx]; var lightLocation = groupLightsLocations[lightIdx];
var serviceID
var serviceID;
if (isAPIv2Ready) { if (isAPIv2Ready) {
serviceID = lightLocation.service.rid; serviceID = lightLocation.service.rid;
} }
@ -1540,8 +1540,9 @@ function get_hue_lights(username) {
var lightId = groupLights[id]; var lightId = groupLights[id];
var lightId_v1 = "/lights/" + lightId; var lightId_v1 = "/lights/" + lightId;
var lightName;
if (isAPIv2Ready) { if (isAPIv2Ready) {
light = hueLights.find(light => light.id === lightId); var light = hueLights.find(light => light.id === lightId);
lightName = light.metadata.name; lightName = light.metadata.name;
lightId_v1 = light.id_v1; lightId_v1 = light.id_v1;
} else { } else {
@ -1549,9 +1550,7 @@ function get_hue_lights(username) {
} }
if (isEntertainmentReady) { if (isEntertainmentReady) {
var light;
var lightLocation = {}; var lightLocation = {};
lightLocation = groupLightsLocations[id]; lightLocation = groupLightsLocations[id];
if (lightLocation) { if (lightLocation) {
if (isAPIv2Ready) { if (isAPIv2Ready) {