From 6acdc66470b9cda7b961ed273d36dad39b54c262 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Sun, 9 Mar 2014 19:47:33 -0400 Subject: [PATCH] fixed bug if default templates folder missing (in case you planned on building an entire theme from scratch) --- src/middleware/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/middleware/index.js b/src/middleware/index.js index b2e428f7c1..1d251c2d43 100644 --- a/src/middleware/index.js +++ b/src/middleware/index.js @@ -85,8 +85,12 @@ function compileTemplates(pluginTemplates) { utils.walk(nconf.get('theme_templates_path'), function (err, themeTpls) { var paths = pluginTemplates; - baseTpls = baseTpls.map(function(tpl) { return tpl.replace(nconf.get('base_templates_path'), ''); }); - themeTpls = themeTpls.map(function(tpl) { return tpl.replace(nconf.get('theme_templates_path'), ''); }); + if (!baseTpls || !themeTpls) { + winston.warn('[themes] Could not find base template files at: ' + nconf.get('base_templates_path')); + } + + baseTpls = !baseTpls ? [] : baseTpls.map(function(tpl) { return tpl.replace(nconf.get('base_templates_path'), ''); }); + themeTpls = !themeTpls ? [] : themeTpls.map(function(tpl) { return tpl.replace(nconf.get('theme_templates_path'), ''); }); baseTpls.forEach(function(el, i) { var relative_path = (themeTpls.indexOf(el) !== -1 ? themeTpls[themeTpls.indexOf(el)] : baseTpls[i]),