diff --git a/src/node/self.js b/src/node/self.js index 74a5f490..c8633cff 100644 --- a/src/node/self.js +++ b/src/node/self.js @@ -17,7 +17,7 @@ var path = require('path'); // Determine the name by which name the module was required (either 'paper', // 'paper-jsdom' or 'paper-jsdom-canvas'), and use this to determine if error // exceptions should be thrown or if loading should fail silently. -var parent = module.parent.parent, +var parent = module.parent ? module.parent.parent : null, requireName = parent && path.basename(path.dirname(parent.filename)); requireName = /^paper/.test(requireName) ? requireName : 'paper';