Skip to content

Commit 4452640

Browse files
committed
fix bug when callback is undefined
1 parent b0f7760 commit 4452640

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ RedisClient.prototype.send_command = function (command, args, callback) {
710710
if (command === 'set' || command === 'setex') {
711711
if(args[args.length - 1] === undefined || args[args.length - 1] === null) {
712712
var err = new Error('send_command: ' + command + ' value must not be undefined or null');
713-
return callback(err);
713+
return callback && callback(err);
714714
}
715715
}
716716

test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1780,6 +1780,8 @@ tests.OPTIONAL_CALLBACK_UNDEFINED = function () {
17801780
client.del("op_cb2");
17811781
client.set("op_cb2", "y", undefined);
17821782
client.get("op_cb2", last(name, require_string("y", name)));
1783+
1784+
client.set("op_cb_undefined", undefined, undefined);
17831785
};
17841786

17851787
tests.ENABLE_OFFLINE_QUEUE_TRUE = function () {

0 commit comments

Comments
 (0)