From 3f51775f07af3c4d31d1ea965066fd4946b7ea16 Mon Sep 17 00:00:00 2001 From: Paul Kaplan Date: Mon, 14 Jan 2019 12:20:20 -0500 Subject: [PATCH] Only stop recording if we have collected some samples. On slow machines it was possible to double click record before the chunk of samples had been processed, causing zero-length audio buffers --- src/containers/record-modal.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/containers/record-modal.jsx b/src/containers/record-modal.jsx index 57612953e..a7a9e8f83 100644 --- a/src/containers/record-modal.jsx +++ b/src/containers/record-modal.jsx @@ -43,7 +43,9 @@ class RecordModal extends React.Component { this.setState({recording: true}); } handleStopRecording (samples, sampleRate, levels, trimStart, trimEnd) { - this.setState({samples, sampleRate, levels, trimStart, trimEnd, recording: false}); + if (samples.length > 0) { + this.setState({samples, sampleRate, levels, trimStart, trimEnd, recording: false}); + } } handlePlay () { this.setState({playing: true});