From a064892a9bb81ed525c0b759d35c56452192ff49 Mon Sep 17 00:00:00 2001 From: Vitaly Turovsky <vital2580@icloud.com> Date: Fri, 20 Dec 2024 17:54:38 +0300 Subject: [PATCH] fix rare crash on auth error (cancel server connect later) --- src/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/index.ts b/src/index.ts index 81e0d78d2..9eaf35d17 100644 --- a/src/index.ts +++ b/src/index.ts @@ -623,6 +623,7 @@ async function connect (connectOptions: ConnectOptions) { } else { const originalSetSocket = bot._client.setSocket.bind(bot._client) bot._client.setSocket = (socket) => { + if (!bot) return originalSetSocket(socket) setupConnectHandlers() }