Skip to content
Snippets Groups Projects
Commit 395b3d9d authored by Paul Kaplan's avatar Paul Kaplan
Browse files

Prevent 0 sample sounds while trimming #715

parent 329a6b5f
No related branches found
No related tags found
No related merge requests found
......@@ -120,8 +120,10 @@ class SoundEditor extends React.Component {
const sampleCount = samples.length;
const startIndex = Math.floor(this.state.trimStart * sampleCount);
const endIndex = Math.floor(this.state.trimEnd * sampleCount);
const clippedSamples = samples.slice(startIndex, endIndex);
this.submitNewSamples(clippedSamples, sampleRate);
if (endIndex > startIndex) { // Strictly greater to prevent 0 sample sounds
const clippedSamples = samples.slice(startIndex, endIndex);
this.submitNewSamples(clippedSamples, sampleRate);
}
}
}
handleUpdateTrimEnd (trimEnd) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment