Skip to content

Commit

Permalink
Guard destroying the component.
Browse files Browse the repository at this point in the history
When running an `ember` application embedded, it might cause the DOM to be cleaned before the `willDestroyElement` hook runs.
  • Loading branch information
btecu committed Sep 12, 2016
1 parent a413d9a commit 3de1705
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion addon/components/bs-datetimepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ export default Component.extend({
this.removeObserver('maxDate');
this.removeObserver('minDate');

this.$().data('DateTimePicker').destroy();
// Running the `ember` application embedded might cause the DOM to be cleaned before
let dateTimePicker = this.$().data('DateTimePicker');
if (dateTimePicker) {
dateTimePicker.destroy();
}
},

actions: {
Expand Down

0 comments on commit 3de1705

Please sign in to comment.