From 974fa37e4ed629a42361548f7844ca4b56b9488b Mon Sep 17 00:00:00 2001 From: Sam Wen Date: Thu, 9 Dec 2021 17:21:30 -0500 Subject: [PATCH] fix reply[2] is null issue when works with the new server assist client side cache feature, redis sends single string "__redis__:invalidate" from server. so reply[2] is null, the update fixes the issue --- lib/DataHandler.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/DataHandler.ts b/lib/DataHandler.ts index eb062ae3..bce39173 100644 --- a/lib/DataHandler.ts +++ b/lib/DataHandler.ts @@ -119,7 +119,7 @@ export default class DataHandler { case "message": if (this.redis.listeners("message").length > 0) { // Check if there're listeners to avoid unnecessary `toString()`. - this.redis.emit("message", reply[1].toString(), reply[2].toString()); + this.redis.emit("message", reply[1].toString(), reply[2] ? reply[2].toString() : ''); } this.redis.emit("messageBuffer", reply[1], reply[2]); break;