Added check for empty notes vector in shiftPos (#6252)

This commit is contained in:
merrickclay
2022-01-06 15:37:08 -07:00
committed by GitHub
parent 13e55101f0
commit 54fff4ff23

View File

@@ -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;