1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-05 14:18:53 +02:00

Add explicit cast to sampleCount where negative values are possible

This commit is contained in:
Paul Licameli 2016-08-21 14:34:26 -04:00
parent a6de680cdb
commit 69064edf20

View File

@ -2715,8 +2715,12 @@ constSamplePtr WaveTrackCache::Get(sampleFormat format,
sampleCount remaining = len;
// Possibly get an initial portion that is uncached
const sampleCount initLen =
mNValidBuffers < 1 ? len : std::min(len, mBuffers[0].start - start);
// This may be negative
const auto initLen =
mNValidBuffers < 1 ? sampleCount( len )
: std::min(sampleCount( len ), mBuffers[0].start - start);
if (initLen > 0) {
// This might be fetching zeroes between clips
mOverlapBuffer.Resize(len, format);