Node.js based forum software built for the modern web
closes #2916
psychobunny4a9498e10544
diff --git a/src/rewards/admin.js b/src/rewards/admin.jsindex 30bed9e0e8..fac78bfeec 100644--- a/src/rewards/admin.js+++ b/src/rewards/admin.js@@ -15,7 +15,7 @@ rewards.save = function(data, callback) {data.id = id;- async.waterfall([+ async.series([function(next) {rewards.delete(data, next);},@@ -97,7 +97,7 @@ function saveConditions(data, callback) {db.setAdd('conditions:active', conditions, callback);async.each(Object.keys(rewardsPerCondition), function(condition, next) {- db.setAdd('condition:' + condition + ':rewards', rewardsPerCondition[condition]);+ db.setAdd('condition:' + condition + ':rewards', rewardsPerCondition[condition], next);}, callback);});}@@ -114,8 +114,10 @@ function getActiveRewards(callback) {db.getObject('rewards:id:' + id + ':rewards', next);}}, function(err, data) {- data.main.rewards = data.rewards;- activeRewards.push(data.main);+ if (data.main) {+ data.main.rewards = data.rewards;+ activeRewards.push(data.main);+ }next(err);});