added error check to getTopicDataWithUser

v1.18.x
Baris Soner Usakli 11 years ago
parent 0f8ee3a671
commit ed8e76ebce

@ -325,13 +325,13 @@ var async = require('async'),
Topics.getTopicDataWithUser = function(tid, callback) {
Topics.getTopicData(tid, function(err, topic) {
if(err) {
return callback(err, null);
if(err || !topic) {
return callback(err || new Error('topic doesn\'t exist'));
}
user.getUserFields(topic.uid, ['username', 'userslug', 'picture'] , function(err, userData) {
if(err) {
return callback(err, null);
return callback(err);
}
topic.username = userData.username;
@ -859,11 +859,7 @@ var async = require('async'),
}
function getReadStatus(next) {
if (uid && parseInt(uid, 10) > 0) {
Topics.hasReadTopic(tid, uid, next);
} else {
next(null, null);
}
Topics.hasReadTopic(tid, uid, next);
}
function getTeaser(next) {

Loading…
Cancel
Save