From e2c6f7c83ed747d9461a9bd716de269c49a18bb4 Mon Sep 17 00:00:00 2001 From: Ben Limmer Date: Tue, 10 Nov 2015 10:44:43 -0700 Subject: [PATCH] Protect against NPE in linting config. Fixes #88. --- index.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 69af7af..0c59bcf 100644 --- a/index.js +++ b/index.js @@ -63,8 +63,11 @@ module.exports = { return path.join(__dirname, 'blueprints'); }, - included: function(app) { - this._super.included(app); + included: function included(app, parentAddon) { + var target = (parentAddon || app); + this._super.included.call(this, target); + + this.options = target.options; if (app.tests) { var fileAssets = [ @@ -122,7 +125,7 @@ module.exports = { lintTree: function(type, tree) { // Skip if useLintTree === false. - if (this.options['ember-cli-mocha'] && this.options['ember-cli-mocha'].useLintTree === false) { + if (this.options && this.options['ember-cli-mocha'] && this.options['ember-cli-mocha'].useLintTree === false) { // Fakes an empty broccoli tree return { inputTree: tree, rebuild: function() { return []; } }; }