From 506b15cd4fd96aae08d23dced672e3afb1ef2aed Mon Sep 17 00:00:00 2001 From: Willem Dantuma Date: Tue, 19 May 2020 11:51:06 +0200 Subject: [PATCH] Fix null ref --- .../components/aol/gps-location/gps-location.component.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/projects/common-map/src/fm-map/components/aol/gps-location/gps-location.component.ts b/projects/common-map/src/fm-map/components/aol/gps-location/gps-location.component.ts index 4c66784..2bb45fc 100644 --- a/projects/common-map/src/fm-map/components/aol/gps-location/gps-location.component.ts +++ b/projects/common-map/src/fm-map/components/aol/gps-location/gps-location.component.ts @@ -59,9 +59,11 @@ export class GpsLocation implements OnInit,OnChanges{ ngOnChanges(changes: SimpleChanges) { if (changes.position && this.instance) { var p = changes.position.currentValue as Position; - this.instance.setPosition(fromLonLat([p.coords.longitude, p.coords.latitude])); - this.locationTolerance = p.coords.accuracy; - this.recalcLocationTolerance(); + if(p) { + this.instance.setPosition(fromLonLat([p.coords.longitude, p.coords.latitude])); + this.locationTolerance = p.coords.accuracy; + this.recalcLocationTolerance(); + } } if(changes.heading && this.instance) { this.rotate = "rotate(" + Math.round(changes.heading.currentValue) + " 500 500)";