Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/notation/internal/notationinteraction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4083,6 +4083,10 @@ void NotationInteraction::moveElementSelection(MoveDirection d)

// VBoxes are not included in horizontal layouts - skip over them (and their contents) when moving selections...
const auto nextNonVBox = [this, isLeftDirection](EngravingItem* currElem) -> EngravingItem* {
IF_ASSERT_FAILED(currElem) {
return nullptr;
}

while (const EngravingItem* vBox = currElem->findAncestor(ElementType::VBOX)) {
currElem = isLeftDirection ? toVBox(vBox)->prevMM() : toVBox(vBox)->nextMM();
if (currElem && currElem->isMeasure()) {
Expand All @@ -4091,7 +4095,12 @@ void NotationInteraction::moveElementSelection(MoveDirection d)
Measure* mb = toMeasure(currElem);
currElem = isLeftDirection ? mb->prevElementStaff(si, currElem) : mb->nextElementStaff(si, currElem);
}

if (!currElem) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem was that currElem could become null, and we called the method (currElem->findAncestor(ElementType::VBOX)) on a null pointer in while

break;
}
}

return currElem;
};

Expand Down
Loading