Skip to content

Commit

Permalink
Added check for empty notes vector in shiftPos (#6252)
Browse files Browse the repository at this point in the history
  • Loading branch information
merrickclay authored Jan 6, 2022
1 parent 13e5510 commit 54fff4f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/gui/editors/PianoRoll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1222,6 +1222,11 @@ void PianoRoll::shiftPos(int amount) //Shift notes pos by amount
void PianoRoll::shiftPos(NoteVector notes, int amount)
{
m_pattern->addJournalCheckPoint();

if (notes.isEmpty()) {
return;
}

auto leftMostPos = notes.first()->pos();
//Limit leftwards shifts to prevent moving left of pattern start
auto shiftAmount = (leftMostPos > -amount) ? amount : -leftMostPos;
Expand Down

0 comments on commit 54fff4f

Please sign in to comment.