You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-07 13:22:56 +03:00
remove null for rewind and use throw mechanism, should help with #273
Fix #275 Signed-off-by: DTrejo <david.trejo@voxer.com>
This commit is contained in:
@@ -46,6 +46,11 @@ ReplyParser.prototype._parseResult = function (type) {
|
|||||||
// include the delimiter
|
// include the delimiter
|
||||||
this._offset = end + 2;
|
this._offset = end + 2;
|
||||||
|
|
||||||
|
if (end > this._buffer.length) {
|
||||||
|
this._offset = start;
|
||||||
|
throw new Error("too far");
|
||||||
|
}
|
||||||
|
|
||||||
if (this.options.return_buffers) {
|
if (this.options.return_buffers) {
|
||||||
return this._buffer.slice(start, end);
|
return this._buffer.slice(start, end);
|
||||||
} else {
|
} else {
|
||||||
@@ -63,6 +68,11 @@ ReplyParser.prototype._parseResult = function (type) {
|
|||||||
// include the delimiter
|
// include the delimiter
|
||||||
this._offset = end + 2;
|
this._offset = end + 2;
|
||||||
|
|
||||||
|
if (end > this._buffer.length) {
|
||||||
|
this._offset = start;
|
||||||
|
throw new Error("too far");
|
||||||
|
}
|
||||||
|
|
||||||
// return the coerced numeric value
|
// return the coerced numeric value
|
||||||
return +small_toString(this._buffer, start, end);
|
return +small_toString(this._buffer, start, end);
|
||||||
} else if (type === 36) { // $
|
} else if (type === 36) { // $
|
||||||
@@ -85,7 +95,7 @@ ReplyParser.prototype._parseResult = function (type) {
|
|||||||
|
|
||||||
if (end > this._buffer.length) {
|
if (end > this._buffer.length) {
|
||||||
this._offset = offset;
|
this._offset = offset;
|
||||||
return null;
|
throw new Error("too far");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.options.return_buffers) {
|
if (this.options.return_buffers) {
|
||||||
|
Reference in New Issue
Block a user