From ee04d03bdb07f082077b47bf30a4b603ebe8a948 Mon Sep 17 00:00:00 2001 From: hippoz Date: Sun, 27 Jun 2021 14:04:50 +0300 Subject: [PATCH] hopefully fix promise rejection for session counter --- brainlet/api/v2/gateway/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/brainlet/api/v2/gateway/index.js b/brainlet/api/v2/gateway/index.js index 0e9f4c3..54bc85f 100644 --- a/brainlet/api/v2/gateway/index.js +++ b/brainlet/api/v2/gateway/index.js @@ -74,7 +74,7 @@ class GatewayServer extends EventEmitter { ws.alive = true; }); ws.on("close", async () => { - if (this.sessionCounters[ws.session.user._id] <= 1) { + if (ws.session.user && this.sessionCounters[ws.session.user._id] <= 1) { this.inChannel(ws.channels[0], (client) => { console.log(client.session); client.send(packet("EVENT_CHANNEL_MEMBERS", {