mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-15 18:26:15 +01:00
fix recent replies crash, closes #2575
This commit is contained in:
@@ -61,7 +61,7 @@ module.exports = function(Categories) {
|
||||
|
||||
function assignPostsToCategory(category, posts) {
|
||||
category.posts = posts.filter(function(post) {
|
||||
return parseInt(post.category.cid, 10) === parseInt(category.cid, 10);
|
||||
return post.category && parseInt(post.category.cid, 10) === parseInt(category.cid, 10);
|
||||
}).sort(function(a, b) {
|
||||
return b.timestamp - a.timestamp;
|
||||
}).slice(0, parseInt(category.numRecentReplies, 10));
|
||||
|
||||
Reference in New Issue
Block a user