1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-07 13:22:56 +03:00

fix null key response: issue #267

This commit is contained in:
Jerry Sievert
2012-09-11 11:43:18 -07:00
parent cbcb8ca5b9
commit 668dfdead6

View File

@@ -74,7 +74,7 @@ ReplyParser.prototype._parseResult = function (type) {
// packets with a size of -1 are considered null
if (packetHeader.size === -1) {
return null;
return undefined;
}
end = this._offset + packetHeader.size;
@@ -108,7 +108,7 @@ ReplyParser.prototype._parseResult = function (type) {
}
var reply = [ ];
var ntype, i;
var ntype, i, res;
offset = this._offset - 1;
@@ -118,7 +118,11 @@ ReplyParser.prototype._parseResult = function (type) {
if (this._offset === this._buffer.length) {
throw new Error("too far");
}
reply.push(this._parseResult(ntype));
res = this._parseResult(ntype);
if (res === undefined) {
res = null;
}
reply.push(res);
}
return reply;
@@ -171,6 +175,12 @@ ReplyParser.prototype.execute = function (buffer) {
break;
}
// check the state for what is the result of
// a -1, set it back up for a null reply
if (ret === undefined) {
ret = null;
}
this.send_reply(ret);
} else if (type === 42) { // *
// set a rewind point. if a failure occurs,