mirror of
https://github.com/danbulant/discord.js
synced 2026-06-09 01:31:29 +00:00
Prevent error when trying to close stream by assuming all streams have end/destroy methods
This commit is contained in:
parent
44b6233a8d
commit
687970a3ec
1 changed files with 9 additions and 2 deletions
|
|
@ -61,8 +61,15 @@ export default class VoiceConnection extends EventEmitter {
|
||||||
this.playing = false;
|
this.playing = false;
|
||||||
this.playingIntent = null;
|
this.playingIntent = null;
|
||||||
if(this.instream){
|
if(this.instream){
|
||||||
this.instream.end();
|
//not all streams implement these...
|
||||||
this.instream.destroy();
|
//and even file stream don't seem to implement them properly...
|
||||||
|
if(this.instream.end) {
|
||||||
|
this.instream.end();
|
||||||
|
}
|
||||||
|
if(this.instream.destroy) {
|
||||||
|
this.instream.destroy();
|
||||||
|
}
|
||||||
|
this.instream = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue