diff --git a/lib/swagger-express/index.js b/lib/swagger-express/index.js index 88bea8d5..53d5cace 100644 --- a/lib/swagger-express/index.js +++ b/lib/swagger-express/index.js @@ -46,6 +46,11 @@ function parseJsDocs(file, fn) { var fragments = js.match(regex); var docs = []; + if (!fragments) { + fn(null, docs); + return; + } + for (var i = 0; i < fragments.length; i++) { var fragment = fragments[i]; var doc = doctrine.parse(fragment, { unwrap: true });