Skip to content

Commit b1d3db4

Browse files
authored
Merge pull request #74 from yapplabs/more-tear-down-safety
Add some more checks to make sure element is not destroyed before accessing it
2 parents ca702dc + 65678fc commit b1d3db4

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

addon/components/nav-stack/component.js

+10-4
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,12 @@ export default class NavStack extends Component {
157157
@action
158158
tearDownHammer() {
159159
let { hammer, gesture } = this;
160-
gesture.unregister(this, hammer.get('pan'));
161-
hammer.off('pan');
162-
hammer.destroy();
163-
this.hammer = null;
160+
if (hammer) {
161+
gesture.unregister(this, hammer.get('pan'));
162+
hammer.off('pan');
163+
hammer.destroy();
164+
this.hammer = null;
165+
}
164166
}
165167

166168
@action
@@ -169,6 +171,10 @@ export default class NavStack extends Component {
169171
}
170172

171173
handleStackDepthChange(isInitialRender) {
174+
if (this.isDestroying || this.isDestroyed) {
175+
return;
176+
}
177+
172178
let stackItems = this.stackItems || [];
173179
let stackDepth = stackItems.length;
174180
let rootComponentRef = stackItems[0] && stackItems[0].component;

0 commit comments

Comments
 (0)