Skip to content

Commit

Permalink
Merge pull request #68 from vleput/master
Browse files Browse the repository at this point in the history
fix: check whether directionsDisplay undefined onDestroy
  • Loading branch information
explooosion authored May 27, 2019
2 parents 4a4c9ee + e09e4e9 commit 445d1bb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/directive/agm-direction.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,11 @@ export class AgmDirection implements OnChanges, OnInit, OnDestroy {
* This event is fired when remove directions
*/
private removeDirections(): void {
this.directionsDisplay.setPanel(null);
this.directionsDisplay.setMap(null);
this.directionsDisplay = undefined;
if (this.directionsDisplay !== undefined) {
this.directionsDisplay.setPanel(null);
this.directionsDisplay.setMap(null);
this.directionsDisplay = undefined;
}
}

/**
Expand Down

0 comments on commit 445d1bb

Please sign in to comment.