Fixing error when properties is null

merge-requests/7/head
Rasika Perera 8 years ago
parent 12c8483b4b
commit 99fee36f2c

@ -254,10 +254,12 @@ deviceModule = function () {
var device = parse(backendResponse.responseText); var device = parse(backendResponse.responseText);
var propertiesList = device["properties"]; var propertiesList = device["properties"];
var properties = {}; var properties = {};
if (propertiesList) {
for (var i = 0; i < propertiesList.length; i++) { for (var i = 0; i < propertiesList.length; i++) {
properties[propertiesList[i]["name"]] = properties[propertiesList[i]["name"]] =
propertiesList[i]["value"]; propertiesList[i]["value"];
} }
}
var deviceObject = {}; var deviceObject = {};
deviceObject[constants["DEVICE_IDENTIFIER"]] = device["deviceIdentifier"]; deviceObject[constants["DEVICE_IDENTIFIER"]] = device["deviceIdentifier"];
deviceObject[constants["DEVICE_NAME"]] = device["name"]; deviceObject[constants["DEVICE_NAME"]] = device["name"];

Loading…
Cancel
Save