Fix #2018 (rapid joining/leaving of voice channel causes a crash)

This commit is contained in:
Amish Shah
2017-10-22 14:29:49 +01:00
parent 356778b9d5
commit 29d743a521

View File

@@ -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);