From 102c142c5868ab572c23eb3a3f65979c68180fc1 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 21 Jun 2015 17:40:58 +1200 Subject: Fix first report problem --- web/app/view/map/MapController.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/web/app/view/map/MapController.js b/web/app/view/map/MapController.js index cbe3ea6c3..f830593e3 100644 --- a/web/app/view/map/MapController.js +++ b/web/app/view/map/MapController.js @@ -167,12 +167,16 @@ Ext.define('Traccar.view.map.MapController', { reportClear: function() { var index; var vectorSource = this.getView().vectorSource; - - vectorSource.removeFeature(this.reportRoute); - for (var key in this.reportRoutePoints) { - if (this.reportRoutePoints.hasOwnProperty(key)) { - vectorSource.removeFeature(this.reportRoutePoints[key]); + if (this.reportRoute !== undefined) { + vectorSource.removeFeature(this.reportRoute); + } + + if (this.reportRoutePoints !== undefined) { + for (var key in this.reportRoutePoints) { + if (this.reportRoutePoints.hasOwnProperty(key)) { + vectorSource.removeFeature(this.reportRoutePoints[key]); + } } } -- cgit v1.2.3