Skip to content

Commit ac8172e

Browse files
author
Wykks
committed
fix(geojsonSource): protect onDestroy
fix #6
1 parent 4a09a80 commit ac8172e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/app/lib/source/geojson/geojson-source.component.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,10 @@ export class GeoJSONSourceComponent implements OnInit, OnDestroy, OnChanges, Geo
8282
}
8383

8484
ngOnDestroy() {
85-
this.sub.unsubscribe();
86-
this.MapService.removeSource(this.id);
85+
if (this.sourceAdded) {
86+
this.sub.unsubscribe();
87+
this.MapService.removeSource(this.id);
88+
}
8789
}
8890

8991
addFeature(feature: GeoJSON.Feature<GeoJSON.GeometryObject>) {

0 commit comments

Comments
 (0)