From 1fe5a8788fa359ad338de1837d3dbc5ae357b021 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Wed, 24 Sep 2014 21:37:26 -0400 Subject: [PATCH] check err --- src/routes/api.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/routes/api.js b/src/routes/api.js index aff69efe9e..3e5512ac47 100644 --- a/src/routes/api.js +++ b/src/routes/api.js @@ -151,6 +151,9 @@ function getTemplatesListing(req, res, next) { }, config: function(next) { fs.readFile(path.join(nconf.get('views_dir'), 'config.json'), function(err, config) { + if (err) { + return next(err); + } config = JSON.parse(config.toString()); plugins.fireHook('filter:templates.get_config', config, next); }); @@ -159,7 +162,7 @@ function getTemplatesListing(req, res, next) { if (err) { return next(err); } - + var data = []; data = results.views.filter(function(value, index, self) { return self.indexOf(value) === index;