From a978f763e3bfebab54768f874a01da8700fdf8b5 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Wed, 30 Mar 2016 11:44:42 -0400 Subject: [PATCH] fixes crash https://github.com/NodeBB/nodebb-theme-persona/issues/250 --- public/src/modules/helpers.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/public/src/modules/helpers.js b/public/src/modules/helpers.js index 3c964b819c..fda87711fb 100644 --- a/public/src/modules/helpers.js +++ b/public/src/modules/helpers.js @@ -1,6 +1,6 @@ ;(function(exports) { "use strict"; - /* globals define, utils */ + /* globals define, utils, config */ // export the class if we are in a Node-like system. if (typeof module === 'object' && module.exports === exports) { @@ -102,11 +102,13 @@ helpers.generateChildrenCategories = function(category) { var html = ''; + var relative_path = (typeof config !== 'undefined' ? config.relative_path : require('nconf').get('relative_path')); + category.children.forEach(function(child) { if (!child) { return; } - var link = child.link ? child.link : (config.relative_path + '/category/' + child.slug); + var link = child.link ? child.link : (relative_path + '/category/' + child.slug); html += '' + '' + '' +