From 495755b074baddf1179102dd0d7fd5c20e9d1277 Mon Sep 17 00:00:00 2001 From: David Bailes Date: Thu, 11 May 2017 11:42:56 +0100 Subject: [PATCH] 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. --- src/Menus.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Menus.cpp b/src/Menus.cpp index c3cc44626..3fc50d95f 100644 --- a/src/Menus.cpp +++ b/src/Menus.cpp @@ -6631,7 +6631,7 @@ double AudacityProject::AdjustForFindingStartTimes(const std::vectorGetEndTime() == time; }); - if (q <= clips.end() - 2 && + if (q != clips.end() && q + 1 != clips.end() && (*q)->GetEndSample() == (*(q+1))->GetStartSample()) { time = (*(q+1))->GetStartTime(); }