fixing posible null pointer excep

4.x.x
kamidu 8 years ago
parent a85b5688a9
commit 3b9ae200e7

@ -194,25 +194,26 @@ deviceModule = function () {
} }
if (device["deviceInfo"]) { if (device["deviceInfo"]) {
filteredDeviceData["latestDeviceInfo"] = device["deviceInfo"]; filteredDeviceData["latestDeviceInfo"] = device["deviceInfo"];
}
//location related verification and modifications //location related verification and modifications
// adding the location histry for the movement path. // adding the location histry for the movement path.
var locationHistory = {}; var locationHistory = {};
locationHistory.locations = locationData; locationHistory.locations = locationData;
locationHistory.times = locationTimeData; locationHistory.times = locationTimeData;
filteredDeviceData["locationHistory"] = locationHistory; filteredDeviceData["locationHistory"] = locationHistory;
//checking for the latest location information. //checking for the latest location information.
if (filteredDeviceData.latestDeviceInfo.location && locationInfo) { if (filteredDeviceData.latestDeviceInfo.location && locationInfo) {
var infoDate = new Date(filteredDeviceData.latestDeviceInfo.location.updatedTime); var infoDate = new Date(filteredDeviceData.latestDeviceInfo.location.updatedTime);
var locationDate = new Date(locationInfo.updatedOn); var locationDate = new Date(locationInfo.updatedOn);
if (infoDate < locationDate) { if (infoDate < locationDate) {
filteredDeviceData.latestDeviceInfo.location.longitude = locationInfo.longitude; filteredDeviceData.latestDeviceInfo.location.longitude = locationInfo.longitude;
filteredDeviceData.latestDeviceInfo.location.latitude = locationInfo.latitude; filteredDeviceData.latestDeviceInfo.location.latitude = locationInfo.latitude;
}
} }
} }
response["content"] = filteredDeviceData; response["content"] = filteredDeviceData;
response["status"] = "success"; response["status"] = "success";
return response; return response;

@ -98,7 +98,6 @@ function loadRoles() {
var dataFilter = function (data) { var dataFilter = function (data) {
data = JSON.parse(data); data = JSON.parse(data);
console.log(data);
var objects = []; var objects = [];
var count = 0; var count = 0;
$(data.roles).each(function (index) { $(data.roles).each(function (index) {

Loading…
Cancel
Save