FIX: Safer JS code

This commit is contained in:
Robin Ward 2015-09-02 15:33:44 -04:00
parent f11bdd13fc
commit d1717cdb12
1 changed files with 7 additions and 3 deletions

View File

@ -125,9 +125,13 @@ export default Ember.Component.extend({
clearInterval(this._resizeInterval);
this._resizeInterval = setInterval(() => {
Ember.run(() => {
const contentHeight = parseInt(this.$('.panel-body-contents').height());
if (contentHeight !== this._lastHeight) { this.performLayout(); }
this._lastHeight = contentHeight;
const $panelBodyContents = this.$('.panel-body-contents');
if ($panelBodyContents.length) {
const contentHeight = parseInt($panelBodyContents.height());
if (contentHeight !== this._lastHeight) { this.performLayout(); }
this._lastHeight = contentHeight;
}
});
}, 500);
}