Skip to content

Commit

Permalink
Guard against missing rc files
Browse files Browse the repository at this point in the history
  • Loading branch information
julienp committed May 6, 2011
1 parent fa73513 commit df7e8fb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/cli.js
Expand Up @@ -11,10 +11,13 @@ function _version() {
}

function _mergeConfigs(homerc, cwdrc) {
var homeConfig = JSON.parse(_fs.readFileSync(homerc, "utf-8")),
cwdConfig = JSON.parse(_fs.readFileSync(cwdrc, "utf-8")),
var homeConfig = {},
cwdConfig = {},
prop;

if (_path.existsSync(homerc)) homeConfig = JSON.parse(_fs.readFileSync(homerc, "utf-8"));
if (_path.existsSync(cwdrc)) cwdConfig = JSON.parse(_fs.readFileSync(cwdrc, "utf-8"));

for (prop in cwdConfig) {
if (typeof prop === 'string') {
if (prop === 'predef') {
Expand Down

0 comments on commit df7e8fb

Please sign in to comment.