1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-05 22:59:29 +02:00

(bug 451, p2) When I made the change to actually enforce the bounds on sampleCount s (i.e., [0, mNumSamples]), I used the test from the old (2002!) code. But the test on the upper limit was wrong -- the second test should have been >, not >=, because if (s == mNumSamples), there's no point in setting s to mNumSamples. This fired the new assert when s and mNumSamples are both 0. Fixed it to check >.

This commit is contained in:
v.audacity 2011-11-20 19:28:45 +00:00
parent 2278cdce95
commit 6f768cb889

View File

@ -388,11 +388,13 @@ bool Sequence::Paste(sampleCount s, const Sequence *src)
{
// This ancient code just blithely bounded s, rather than throwing an error.
// Now enforcing the bounds.
// Also, the second test should have been >, not >=, because if (s == mNumSamples),
// there's no point in setting s to mNumSamples.
//if ((s < 0)
// s = 0;
//if (s >= mNumSamples)
// s = mNumSamples;
if ((s < 0) || (s >= mNumSamples))
if ((s < 0) || (s > mNumSamples))
{
wxLogError(
wxT("Sequence::Paste: sampleCount s %s is < 0 or > mNumSamples %s)."),