From 0f66077bf5bc439320c5992d4887362f9c6daca4 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Fri, 7 Nov 2014 10:50:25 -0500 Subject: [PATCH] fixed issue where purged posts would cause the upgrader to fail, closed #2359 --- src/upgrade.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/upgrade.js b/src/upgrade.js index 21e9ffde51..15897e8898 100644 --- a/src/upgrade.js +++ b/src/upgrade.js @@ -1190,7 +1190,12 @@ Upgrade.upgrade = function(callback) { function(tids, next) { async.eachLimit(tids, 100, function(tid, next) { Topics.getTopicFields(tid, ['uid', 'cid', 'tid', 'timestamp'], function(err, data) { - db.sortedSetAdd('cid:' + data.cid + ':uid:' + data.uid + ':tid', data.timestamp, data.tid, next); + if (!err && (data.cid && data.uid && data.timestamp && data.tid)) { + db.sortedSetAdd('cid:' + data.cid + ':uid:' + data.uid + ':tid', data.timestamp, data.tid, next); + } else { + // Post was probably purged, skip record + next(); + } }); }, next); }