empty array if not topics in catgory

v1.18.x
Baris Soner Usakli 11 years ago
parent d5268f5497
commit ad37715972

@ -93,23 +93,23 @@ var db = require('./database'),
topics.getTopicsByTids(tids, cid, uid, next);
},
function(topics, next) {
if (topics && topics.length > 0) {
db.sortedSetRevRank('categories:' + cid + ':tid', topics[topics.length - 1].tid, function(err, rank) {
if(err) {
return next(err);
}
next(null, {
topics: topics,
nextStart: parseInt(rank, 10) + 1
});
if (!topics || !topics.length) {
return next(null, {
topics: [],
nextStart: 1
});
} else {
}
db.sortedSetRevRank('categories:' + cid + ':tid', topics[topics.length - 1].tid, function(err, rank) {
if(err) {
return next(err);
}
next(null, {
topics: topics,
nextStart: 1
nextStart: parseInt(rank, 10) + 1
});
}
});
}
], callback);
};

Loading…
Cancel
Save