Skip to content

Commit 224a10d

Browse files
Merge pull request #205 from OS2iot/hotfix/fix-null-locations-in-application-map
Fix null location for devices
2 parents d96febb + 097de91 commit 224a10d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/app/applications/applications-list/application-map/application-map.component.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,9 @@ export class ApplicationMapComponent implements OnInit, OnDestroy {
6262

6363
if (Array.isArray(this.devices) && this.displayDevices) {
6464
this.devices.forEach(dev => {
65-
const [longitude, latitude] = dev.location.coordinates;
65+
if (!dev.location) return;
6666

67+
const [longitude, latitude] = dev.location.coordinates;
6768
const isActive = dev.latestReceivedMessage?.sentTime
6869
? moment(dev.latestReceivedMessage?.sentTime).unix() > moment(new Date()).subtract(1, "day").unix()
6970
: false;
@@ -91,6 +92,8 @@ export class ApplicationMapComponent implements OnInit, OnDestroy {
9192

9293
if (Array.isArray(this.gateways) && this.displayGateways) {
9394
this.gateways.forEach(gw => {
95+
if (!gw.location) return;
96+
9497
tempCoordinateList.push({
9598
longitude: gw.location.longitude,
9699
latitude: gw.location.latitude,

0 commit comments

Comments
 (0)