diff --git a/src/app/lib/source/geojson/geojson-source.component.ts b/src/app/lib/source/geojson/geojson-source.component.ts index e15847b08..afb4c8b7e 100644 --- a/src/app/lib/source/geojson/geojson-source.component.ts +++ b/src/app/lib/source/geojson/geojson-source.component.ts @@ -82,8 +82,10 @@ export class GeoJSONSourceComponent implements OnInit, OnDestroy, OnChanges, Geo } ngOnDestroy() { - this.sub.unsubscribe(); - this.MapService.removeSource(this.id); + if (this.sourceAdded) { + this.sub.unsubscribe(); + this.MapService.removeSource(this.id); + } } addFeature(feature: GeoJSON.Feature) {