@ -129,7 +129,13 @@ module.exports = function (redisClient, module) {
}
redisClient.zscore(key, value, function (err, score) {
callback(err, !err ? parseFloat(score) : null);
if (err) {
return callback(err);
if (score === null) {
return callback(null, score);
callback(null, parseFloat(score));
});
};
@ -61,7 +61,7 @@ module.exports = function (User) {
async.waterfall([
async.apply(User.getUserFields, uid, ['banned', 'banned:expire']),
function (userData, next) {
var banned = parseInt(userData.banned, 10) === 1;
var banned = userData && parseInt(userData.banned, 10) === 1;
if (!banned) {
return next(null, banned);
@ -190,6 +190,15 @@ describe('Hash methods', function () {
done();
it('should return undefined for all fields if object does not exist', function (done) {
db.getObjectsFields(['doesnotexist1', 'doesnotexist2'], ['name', 'age'], function (err, data) {
assert.ifError(err);
assert.equal(data.name, null);
assert.equal(data.age, null);
describe('getObjectKeys()', function () {
@ -303,6 +303,7 @@ describe('Sorted Set methods', function () {
assert.equal(err, null);
assert.equal(arguments.length, 2);
assert.equal(!!score, false);
assert.strictEqual(score, null);
@ -312,6 +313,7 @@ describe('Sorted Set methods', function () {