add checks to ensure `opts.path` is a string

master
jonschlinkert 8 years ago
parent fc02a62fc3
commit 4741716aaa

@ -106,14 +106,14 @@ parse.resolve = function resolve(options) {
// `git-config-path` determine the path // `git-config-path` determine the path
var type = isGlobal ? 'global' : null; var type = isGlobal ? 'global' : null;
var opts = extend({path: configPath(type)}, options); var opts = extend({path: configPath(type)}, options);
if (exists(opts.path)) { if (opts.path && exists(opts.path)) {
return opts.path; return opts.path;
} }
if (opts.cwd) { if (opts.cwd && opts.path) {
opts.path = path.resolve(opts.cwd, opts.path); return path.resolve(opts.cwd, opts.path);
} }
return path.resolve(opts.path); return opts.path && path.resolve(opts.path);
}; };
/** /**

Loading…
Cancel
Save