Fix corner case where email does not have modseq attribute

This commit is contained in:
Felix Hammerl 2014-11-18 16:33:09 +01:00
parent 906909fd7d
commit eabdeaf888
1 changed files with 2 additions and 2 deletions

View File

@ -1171,14 +1171,14 @@ EmailDAO.prototype.onConnect = function(options, callback) {
});
lastUid = uids[uids.length - 1];
highestModseq = _.pluck(folder.messages, 'modseq').sort(function(a, b) {
highestModseq = (_.pluck(folder.messages, 'modseq').sort(function(a, b) {
// We treat modseq values as numbers here as an exception, should
// be strings everywhere else.
// If it turns out that someone actually uses 64 bit uint numbers
// that do not fit to the JavaScript number type then we should
// use a helper for handling big integers.
return (Number(a) || 0) - (Number(b) || 0);
}).pop().toString();
}).pop() || 0).toString();
mailboxCache[folder.path] = {
exists: lastUid,