From 6c54c282c87e8ce122715e3122abe510e0f9ff7e Mon Sep 17 00:00:00 2001 From: Rob Kayson Date: Sun, 23 Aug 2020 22:13:17 -0700 Subject: [PATCH] RingBuffer: Default to 0 if arraySequence[0] is undefined (#542) Co-authored-by: Robert Kayson --- src/audioWorklet/ringBuffer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/audioWorklet/ringBuffer.js b/src/audioWorklet/ringBuffer.js index 80dc06e9..cb5925ff 100644 --- a/src/audioWorklet/ringBuffer.js +++ b/src/audioWorklet/ringBuffer.js @@ -63,7 +63,7 @@ class RingBuffer { // match with this buffer obejct. // Transfer data from the |arraySequence| storage to the internal buffer. - let sourceLength = arraySequence[0].length; + let sourceLength = arraySequence[0] ? arraySequence[0].length : 0; for (let i = 0; i < sourceLength; ++i) { let writeIndex = (this._writeIndex + i) % this._length; for (let channel = 0; channel < this._channelCount; ++channel) {