diff --git a/lib/config.js b/lib/config.js index 17b6fe037..897a5bc74 100644 --- a/lib/config.js +++ b/lib/config.js @@ -23,18 +23,19 @@ var UrlPattern = function(url) { var createPatternObject = function(pattern) { - if (helper.isString(pattern)) { + if (pattern && helper.isString(pattern)) { return helper.isUrlAbsolute(pattern) ? new UrlPattern(pattern) : new Pattern(pattern); } if (helper.isObject(pattern)) { - if (!helper.isDefined(pattern.pattern)) { - log.warn('Invalid pattern %s!\n\tObject is missing "pattern" property".', pattern); - } - - return helper.isUrlAbsolute(pattern.pattern) ? + if (pattern.pattern && helper.isString(pattern.pattern)) { + return helper.isUrlAbsolute(pattern.pattern) ? new UrlPattern(pattern.pattern) : new Pattern(pattern.pattern, pattern.served, pattern.included, pattern.watched); + } + + log.warn('Invalid pattern %s!\n\tObject is missing "pattern" property.', pattern); + return new Pattern(null, false, false, false); } log.warn('Invalid pattern %s!\n\tExpected string or object with "pattern" property.', pattern);