Skip to content

Commit

Permalink
fix(geojsonSource): protect onDestroy
Browse files Browse the repository at this point in the history
fix #6
  • Loading branch information
Wykks committed Nov 17, 2017
1 parent 4a09a80 commit ac8172e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/app/lib/source/geojson/geojson-source.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<GeoJSON.GeometryObject>) {
Expand Down

0 comments on commit ac8172e

Please sign in to comment.