diff --git a/lib/index.js b/lib/index.js index fec3716..60d9dfe 100644 --- a/lib/index.js +++ b/lib/index.js @@ -77,7 +77,7 @@ var flatten = function(options) { licenseFile = path.join(json.path, filename); // Checking that the file is in fact a normal file and not a directory for example. if (fs.lstatSync(licenseFile).isFile()) { - if (moduleInfo.licenses.indexOf(UNKNOWN) > -1) { + if (!moduleInfo.licenses || moduleInfo.licenses.indexOf(UNKNOWN) > -1) { //Only re-check the license if we didn't get it from elsewhere moduleInfo.licenses = license(fs.readFileSync(licenseFile, {encoding: 'utf8'})); }