diff --git a/index.js b/index.js index b33a158d16..4bb2891b80 100644 --- a/index.js +++ b/index.js @@ -713,7 +713,7 @@ RedisClient.prototype.send_command = function (command, args, callback) { if (command === 'set' || command === 'setex') { 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'); - return callback(err); + return callback && callback(err); } } diff --git a/test.js b/test.js index d985621235..13bf141d88 100644 --- a/test.js +++ b/test.js @@ -1859,6 +1859,8 @@ tests.OPTIONAL_CALLBACK_UNDEFINED = function () { client.del("op_cb2"); client.set("op_cb2", "y", undefined); client.get("op_cb2", last(name, require_string("y", name))); + + client.set("op_cb_undefined", undefined, undefined); }; tests.ENABLE_OFFLINE_QUEUE_TRUE = function () {