Skip to content

Commit

Permalink
Add safety check for MapService.mapInstance before attempting to remove
Browse files Browse the repository at this point in the history
  • Loading branch information
mloffer committed May 10, 2019
1 parent 794099c commit cddeb2a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions projects/ngx-mapbox-gl/src/lib/map/map.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,10 @@ export class MapService {
}

destroyMap() {
this.subscription.unsubscribe();
this.mapInstance.remove();
if(this.mapInstance) {
this.subscription.unsubscribe();
this.mapInstance.remove();
}
}

updateMinZoom(minZoom: number) {
Expand Down

0 comments on commit cddeb2a

Please sign in to comment.