Skip to content

Commit

Permalink
defensive code, fixes #34
Browse files Browse the repository at this point in the history
  • Loading branch information
davglass committed May 12, 2015
1 parent 0479570 commit fc0c083
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'}));
}
Expand Down

0 comments on commit fc0c083

Please sign in to comment.