From 2531065bbda5a1e9db66299523b88e2c6b6f1c3b Mon Sep 17 00:00:00 2001 From: Amish Shah Date: Sat, 4 Nov 2017 15:02:58 +0000 Subject: [PATCH] Fix loop and only emit error, not warn --- src/client/voice/dispatcher/StreamDispatcher.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/voice/dispatcher/StreamDispatcher.js b/src/client/voice/dispatcher/StreamDispatcher.js index 8f08170a3..7c6b98c3e 100644 --- a/src/client/voice/dispatcher/StreamDispatcher.js +++ b/src/client/voice/dispatcher/StreamDispatcher.js @@ -74,11 +74,11 @@ class StreamDispatcher extends Writable { * Emitted when the dispatcher encounters an error. * @event StreamDispatcher#error */ - this.emit(this.listenerCount('error') > 0 ? 'error' : 'warn', err); + if (err) this.emit('error', err); this.destroy(); }; - this.on('error', streamError); + this.on('error', () => streamError()); if (this.streams.input) this.streams.input.on('error', streamError); if (this.streams.ffmpeg) this.streams.ffmpeg.on('error', streamError); if (this.streams.opus) this.streams.opus.on('error', streamError);