You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-09 00:22:08 +03:00
fix null key response: issue #267
This commit is contained in:
@@ -74,7 +74,7 @@ ReplyParser.prototype._parseResult = function (type) {
|
|||||||
|
|
||||||
// packets with a size of -1 are considered null
|
// packets with a size of -1 are considered null
|
||||||
if (packetHeader.size === -1) {
|
if (packetHeader.size === -1) {
|
||||||
return null;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
end = this._offset + packetHeader.size;
|
end = this._offset + packetHeader.size;
|
||||||
@@ -108,7 +108,7 @@ ReplyParser.prototype._parseResult = function (type) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var reply = [ ];
|
var reply = [ ];
|
||||||
var ntype, i;
|
var ntype, i, res;
|
||||||
|
|
||||||
offset = this._offset - 1;
|
offset = this._offset - 1;
|
||||||
|
|
||||||
@@ -118,7 +118,11 @@ ReplyParser.prototype._parseResult = function (type) {
|
|||||||
if (this._offset === this._buffer.length) {
|
if (this._offset === this._buffer.length) {
|
||||||
throw new Error("too far");
|
throw new Error("too far");
|
||||||
}
|
}
|
||||||
reply.push(this._parseResult(ntype));
|
res = this._parseResult(ntype);
|
||||||
|
if (res === undefined) {
|
||||||
|
res = null;
|
||||||
|
}
|
||||||
|
reply.push(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
return reply;
|
return reply;
|
||||||
@@ -171,6 +175,12 @@ ReplyParser.prototype.execute = function (buffer) {
|
|||||||
break;
|
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);
|
this.send_reply(ret);
|
||||||
} else if (type === 42) { // *
|
} else if (type === 42) { // *
|
||||||
// set a rewind point. if a failure occurs,
|
// set a rewind point. if a failure occurs,
|
||||||
|
Reference in New Issue
Block a user