make sure postcount isnt NaN

v1.18.x
barisusakli 11 years ago
parent 32d0e0d7e5
commit 2af077544b

@ -18,7 +18,10 @@ module.exports = function(Topics) {
if (err) { if (err) {
return next(err); return next(err);
} }
var postCountChange = incr * parseInt(topicData.postcount, 10); topicData.postcount = parseInt(topicData.postcount, 10);
topicData.postcount = topicData.postcount || 0;
var postCountChange = incr * topicData.postcount;
async.parallel([ async.parallel([
function(next) { function(next) {
db.incrObjectFieldBy('global', 'postCount', postCountChange, next); db.incrObjectFieldBy('global', 'postCount', postCountChange, next);

Loading…
Cancel
Save