diff options
Diffstat (limited to 'web/app/view/map')
-rw-r--r-- | web/app/view/map/MapController.js | 14 |
1 files 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]); + } } } |