From 7cab2b0fea4cd66a0dd34073478d3d1ae350f63a Mon Sep 17 00:00:00 2001 From: Andrew Rodrigues Date: Tue, 28 Apr 2020 15:49:06 -0400 Subject: [PATCH] fix: crash when res.locals.linkTags is undefined --- src/controllers/topics.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/controllers/topics.js b/src/controllers/topics.js index 71c1f03ae4..ac8868e445 100644 --- a/src/controllers/topics.js +++ b/src/controllers/topics.js @@ -92,6 +92,7 @@ topicsController.get = async function getTopic(req, res, callback) { topicData.pagination = pagination.create(currentPage, pageCount, req.query); topicData.pagination.rel.forEach(function (rel) { rel.href = nconf.get('url') + '/topic/' + topicData.slug + rel.href; + res.locals.linkTags = res.locals.linkTags || []; res.locals.linkTags.push(rel); });