voice: resolve issue where dispatcher tried to send packets to null socket (#2317)

This commit is contained in:
Amish Shah
2018-03-06 10:21:44 +00:00
parent 835bff74cd
commit 8289b70e2c

View File

@@ -242,10 +242,13 @@ class StreamDispatcher extends Writable {
*/
this._setSpeaking(true);
while (repeats--) {
if (!this.player.voiceConnection.sockets.udp) {
this.emit('debug', 'Failed to send a packet - no UDP socket');
}
this.player.voiceConnection.sockets.udp.send(packet)
.catch(e => {
this._setSpeaking(false);
this.emit('debug', `Failed to send a packet ${e}`);
this.emit('debug', `Failed to send a packet - ${e}`);
});
}
}