Skip to content

Commit 949df6a

Browse files
committed
fixed crash on move selection
1 parent d26b912 commit 949df6a

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/notation/internal/notationinteraction.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4083,6 +4083,10 @@ void NotationInteraction::moveElementSelection(MoveDirection d)
40834083

40844084
// VBoxes are not included in horizontal layouts - skip over them (and their contents) when moving selections...
40854085
const auto nextNonVBox = [this, isLeftDirection](EngravingItem* currElem) -> EngravingItem* {
4086+
IF_ASSERT_FAILED(currElem) {
4087+
return nullptr;
4088+
}
4089+
40864090
while (const EngravingItem* vBox = currElem->findAncestor(ElementType::VBOX)) {
40874091
currElem = isLeftDirection ? toVBox(vBox)->prevMM() : toVBox(vBox)->nextMM();
40884092
if (currElem && currElem->isMeasure()) {
@@ -4091,7 +4095,12 @@ void NotationInteraction::moveElementSelection(MoveDirection d)
40914095
Measure* mb = toMeasure(currElem);
40924096
currElem = isLeftDirection ? mb->prevElementStaff(si, currElem) : mb->nextElementStaff(si, currElem);
40934097
}
4098+
4099+
if (!currElem) {
4100+
break;
4101+
}
40944102
}
4103+
40954104
return currElem;
40964105
};
40974106

0 commit comments

Comments
 (0)