1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00

Fixed null HGETALL bug causing exception

This commit is contained in:
Tj Holowaychuk
2010-09-20 07:32:45 -07:00
parent ed77cb4d95
commit a93020c555
2 changed files with 11 additions and 1 deletions

View File

@@ -436,7 +436,7 @@ RedisClient.prototype.return_reply = function (reply) {
if (command_obj) { if (command_obj) {
if (typeof command_obj.callback === "function") { if (typeof command_obj.callback === "function") {
// HGETALL special case replies with keyed Buffers // HGETALL special case replies with keyed Buffers
if ('HGETALL' === command_obj.command) { if (reply && 'HGETALL' === command_obj.command) {
var obj = {}; var obj = {};
for (var i = 0, len = reply.length; i < len; i += 2) { for (var i = 0, len = reply.length; i < len; i += 2) {
var key = reply[i].toString(), var key = reply[i].toString(),

10
test.js
View File

@@ -347,6 +347,16 @@ tests.HGETALL = function () {
}); });
}; };
tests.HGETALL_NULL = function () {
var name = "HGETALL_NULL";
client.hgetall('missing', function(err, obj){
console.log(err);
console.log(obj);
next(name);
});
};
var all_tests = Object.keys(tests), var all_tests = Object.keys(tests),
all_start = new Date(), cur_start, test_count = 0; all_start = new Date(), cur_start, test_count = 0;