mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-06 14:52:34 +02:00
Bug1614: fix crash duplicating a clip
This commit is contained in:
parent
7bda40f656
commit
23dc35a18c
@ -198,7 +198,7 @@ EnvPoint *Envelope::AddPointAtEnd( double t, double val )
|
||||
|
||||
void Envelope::CopyFrom(const Envelope *e, double t0, double t1)
|
||||
{
|
||||
wxASSERT( t0 < t1 );
|
||||
wxASSERT( t0 <= t1 );
|
||||
|
||||
mOffset = wxMax(t0, e->mOffset);
|
||||
mTrackLen = wxMin(t1, e->mOffset + e->mTrackLen) - mOffset;
|
||||
|
@ -378,8 +378,10 @@ float Sequence::GetRMS(sampleCount start, sampleCount len, bool mayThrow) const
|
||||
|
||||
std::unique_ptr<Sequence> Sequence::Copy(sampleCount s0, sampleCount s1) const
|
||||
{
|
||||
if (s0 >= s1 || s0 >= mNumSamples || s1 < 0)
|
||||
return {};
|
||||
auto dest = std::make_unique<Sequence>(mDirManager, mSampleFormat);
|
||||
if (s0 >= s1 || s0 >= mNumSamples || s1 < 0) {
|
||||
return dest;
|
||||
}
|
||||
|
||||
int numBlocks = mBlock.size();
|
||||
|
||||
@ -391,7 +393,6 @@ std::unique_ptr<Sequence> Sequence::Copy(sampleCount s0, sampleCount s1) const
|
||||
wxUnusedVar(numBlocks);
|
||||
wxASSERT(b0 <= b1);
|
||||
|
||||
auto dest = std::make_unique<Sequence>(mDirManager, mSampleFormat);
|
||||
dest->mBlock.reserve(b1 - b0 + 1);
|
||||
|
||||
SampleBuffer buffer(mMaxSamples, mSampleFormat);
|
||||
|
Loading…
x
Reference in New Issue
Block a user