1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-29 06:38:38 +02:00

Fix for keyboard clip commands

Fix bug in AudacityProject::AdjustForFindingStartTimes.
Bug: When there is 0 or 1 clips, q - 2 is before the begin() of the vector, and caused crash.

Fix: split the test into two tests.
This commit is contained in:
David Bailes 2017-05-11 11:42:56 +01:00
parent 6c0e8c7d86
commit 495755b074

View File

@ -6631,7 +6631,7 @@ double AudacityProject::AdjustForFindingStartTimes(const std::vector<const WaveC
{
auto q = std::find_if(clips.begin(), clips.end(), [&] (const WaveClip* const& clip) {
return clip->GetEndTime() == time; });
if (q <= clips.end() - 2 &&
if (q != clips.end() && q + 1 != clips.end() &&
(*q)->GetEndSample() == (*(q+1))->GetStartSample()) {
time = (*(q+1))->GetStartTime();
}