From cf1173b0c4495c7568a92f805b945dd56ed36d95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Wed, 10 Oct 2018 17:24:57 -0400 Subject: [PATCH] closes https://github.com/NodeBB/nodebb-theme-persona/issues/408 --- src/controllers/categories.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/controllers/categories.js b/src/controllers/categories.js index 1eb46a0041..b15db0bbff 100644 --- a/src/controllers/categories.js +++ b/src/controllers/categories.js @@ -47,11 +47,12 @@ categoriesController.list = function (req, res, next) { } data.categories.forEach(function (category) { - if (category && Array.isArray(category.posts) && category.posts.length) { + if (category && Array.isArray(category.posts) && category.posts.length && category.posts[0]) { category.teaser = { url: nconf.get('relative_path') + '/post/' + category.posts[0].pid, timestampISO: category.posts[0].timestampISO, pid: category.posts[0].pid, + topic: category.posts[0].topic, }; } });