summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dgedit/audioextractor.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/dgedit/audioextractor.cc b/dgedit/audioextractor.cc
index 4c6cd4b..8cb4ed0 100644
--- a/dgedit/audioextractor.cc
+++ b/dgedit/audioextractor.cc
@@ -101,13 +101,13 @@ void AudioExtractor::exportSelections()
// Apply linear fadein
for(size_t fi = 0; fi < fadein; fi++) {
float val = ((float)fi / (float)fadein);
- data[fi] *= val;
+ if(fi < size) data[fi] *= val;
}
// Apply fadeout
for(size_t fo = 0; fo < fadeout; fo++) {
float val = ((float)fo / (float)fadeout);
- data[size - fo] *= val;
+ if(size >= fo) data[size - fo] *= val;
}
audiodata[i].data = data;