Skip to content

Node.js based forum software built for the modern web

fix: client side crash if there are no topics

Barış Soner Uşaklıa8e18fdbe68c
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;