From a8e18fdbe68c7c395a2f321d9cf62c234b7656c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Sun, 13 Sep 2020 19:40:01 -0400 Subject: [PATCH] fix: client side crash if there are no topics --- public/src/client/category/tools.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/public/src/client/category/tools.js b/public/src/client/category/tools.js index ccd6f8fedc..7159466f6a 100644 --- a/public/src/client/category/tools.js +++ b/public/src/client/category/tools.js @@ -263,6 +263,9 @@ define('forum/category/tools', [ } function handlePinnedTopicSort() { + if (!ajaxify.data.topics) { + return; + } var numPinned = ajaxify.data.topics.reduce(function (memo, topic) { memo = topic.pinned ? memo += 1 : memo; return memo;