Skip to content

Commit

Permalink
fix(control): add safety check to ngOnDestroy
Browse files Browse the repository at this point in the history
ref #53
  • Loading branch information
Wykks committed Sep 9, 2018
1 parent fd94bd3 commit 5b63325
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion projects/ngx-mapbox-gl/src/lib/control/control.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ export class ControlComponent implements OnDestroy, AfterContentInit {
}

ngOnDestroy() {
this.MapService.removeControl(this.control);
if (this.control) {
this.MapService.removeControl(this.control);
}
}
}

0 comments on commit 5b63325

Please sign in to comment.