Skip to content

Node.js based forum software built for the modern web

check mainPid

barisusaklib16932a67635
diff --git a/src/topics.js b/src/topics.js
index 926f8bb78b..34fe471163 100644
--- a/src/topics.js
+++ b/src/topics.js
@@ -262,7 +262,10 @@ var async = require('async'),
return next(err);
}
- pids = [topicData.mainPid].concat(pids);
+ pids = topicData.mainPid ? [topicData.mainPid].concat(pids) : pids;
+ if (!pids.length) {
+ return next(null, []);
+ }
posts.getPostsByPids(pids, tid, function(err, posts) {
if (err) {
return next(err);