mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 00:53:31 +01:00
Fix #2018 (rapid joining/leaving of voice channel causes a crash)
This commit is contained in:
@@ -103,6 +103,10 @@ class VoiceConnectionUDPClient extends EventEmitter {
|
||||
const socket = this.socket = udp.createSocket('udp4');
|
||||
|
||||
socket.once('message', message => {
|
||||
|
||||
// Stop if the sockets have been deleted because the connection has been closed already
|
||||
if (!this.voiceConnection.sockets.ws) return;
|
||||
|
||||
const packet = parseLocalPacket(message);
|
||||
if (packet.error) {
|
||||
this.emit('error', packet.error);
|
||||
|
||||
Reference in New Issue
Block a user