Skip to content

Node.js based forum software built for the modern web

fix: crash when res.locals.linkTags is undefined

Andrew Rodrigues7cab2b0fea4c
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);
});