You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
fix bug when callback is undefined
This commit is contained in:
2
index.js
2
index.js
@@ -710,7 +710,7 @@ RedisClient.prototype.send_command = function (command, args, callback) {
|
|||||||
if (command === 'set' || command === 'setex') {
|
if (command === 'set' || command === 'setex') {
|
||||||
if(args[args.length - 1] === undefined || args[args.length - 1] === null) {
|
if(args[args.length - 1] === undefined || args[args.length - 1] === null) {
|
||||||
var err = new Error('send_command: ' + command + ' value must not be undefined or null');
|
var err = new Error('send_command: ' + command + ' value must not be undefined or null');
|
||||||
return callback(err);
|
return callback && callback(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
test.js
2
test.js
@@ -1780,6 +1780,8 @@ tests.OPTIONAL_CALLBACK_UNDEFINED = function () {
|
|||||||
client.del("op_cb2");
|
client.del("op_cb2");
|
||||||
client.set("op_cb2", "y", undefined);
|
client.set("op_cb2", "y", undefined);
|
||||||
client.get("op_cb2", last(name, require_string("y", name)));
|
client.get("op_cb2", last(name, require_string("y", name)));
|
||||||
|
|
||||||
|
client.set("op_cb_undefined", undefined, undefined);
|
||||||
};
|
};
|
||||||
|
|
||||||
tests.ENABLE_OFFLINE_QUEUE_TRUE = function () {
|
tests.ENABLE_OFFLINE_QUEUE_TRUE = function () {
|
||||||
|
Reference in New Issue
Block a user