Skip to content

Node.js based forum software built for the modern web

fixed bug if default templates folder missing (in case you planned on building an entire theme from scratch)

psychobunny6acdc66470b9
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]),