From 208dfed7fba700c0db3de682536ae58ba6d70364 Mon Sep 17 00:00:00 2001 From: Willem Dantuma Date: Fri, 29 Jan 2021 12:42:19 +0100 Subject: [PATCH] Add checks --- .../common-map/src/fm-map/services/temporal.service.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/projects/common-map/src/fm-map/services/temporal.service.ts b/projects/common-map/src/fm-map/services/temporal.service.ts index 457c937..6d5a58a 100644 --- a/projects/common-map/src/fm-map/services/temporal.service.ts +++ b/projects/common-map/src/fm-map/services/temporal.service.ts @@ -14,9 +14,9 @@ export class TemporalService { } selectedDate(itemLayer:IItemLayer):string { - let temporalItemLayer = itemLayer as ITemporalItemLayer; - if(temporalItemLayer.selectedItemLayer) { - if(temporalItemLayer.selectedItemLayer.item.dataDate && temporalItemLayer.selectedItemLayer.item.dataEndDate) { + let temporalItemLayer = itemLayer as ITemporalItemLayer; + if(temporalItemLayer && temporalItemLayer.selectedItemLayer) { + if(temporalItemLayer && temporalItemLayer.selectedItemLayer.item.dataDate && temporalItemLayer.selectedItemLayer.item.dataEndDate) { let sd = new Date(Date.parse(temporalItemLayer.selectedItemLayer.item.dataDate)); let ed = new Date(Date.parse(temporalItemLayer.selectedItemLayer.item.dataEndDate)); return this.timespanService$.getCaption(sd,ed); @@ -30,7 +30,7 @@ export class TemporalService { nextDate(itemLayer:IItemLayer):string { let temporalItemLayer = itemLayer as ITemporalItemLayer; - if(temporalItemLayer.nextItemLayer.item) { + if(temporalItemLayer && temporalItemLayer.nextItemLayer && temporalItemLayer.nextItemLayer.item) { if(temporalItemLayer.nextItemLayer.item.dataDate && temporalItemLayer.nextItemLayer.item.dataEndDate) { let sd = new Date(Date.parse(temporalItemLayer.nextItemLayer.item.dataDate)); let ed = new Date(Date.parse(temporalItemLayer.nextItemLayer.item.dataEndDate)); @@ -50,7 +50,7 @@ export class TemporalService { previousDate(itemLayer:IItemLayer):string { let temporalItemLayer = itemLayer as ITemporalItemLayer; - if(temporalItemLayer.previousItemLayer.item) { + if(temporalItemLayer && temporalItemLayer.previousItemLayer && temporalItemLayer.previousItemLayer.item) { if(temporalItemLayer.previousItemLayer.item.dataDate && temporalItemLayer.previousItemLayer.item.dataEndDate) { let sd = new Date(Date.parse(temporalItemLayer.previousItemLayer.item.dataDate)); let ed = new Date(Date.parse(temporalItemLayer.previousItemLayer.item.dataEndDate));