From 5eab5fc06ca6be36ecf1557f2ad29a670d4d5ae7 Mon Sep 17 00:00:00 2001 From: Qjuh <76154676+Qjuh@users.noreply.github.com> Date: Sun, 18 Dec 2022 16:18:07 +0100 Subject: [PATCH] fix(WebSocketShard): only cleanup the connection if a connection still exists (#8946) fix(WebSocketShard): only cleanup if connection --- packages/discord.js/src/client/websocket/WebSocketShard.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/discord.js/src/client/websocket/WebSocketShard.js b/packages/discord.js/src/client/websocket/WebSocketShard.js index 167cd7bad..c18c82aea 100644 --- a/packages/discord.js/src/client/websocket/WebSocketShard.js +++ b/packages/discord.js/src/client/websocket/WebSocketShard.js @@ -603,7 +603,9 @@ class WebSocketShard extends EventEmitter { ); // Cleanup connection listeners - this._cleanupConnection(); + if (this.connection) { + this._cleanupConnection(); + } this.emitClose(); // Setting the variable false to check for zombie connections.