From 949df6a7b0192688e78770760794f680a45e755d Mon Sep 17 00:00:00 2001 From: Igor Korsukov Date: Wed, 27 Aug 2025 16:00:38 +0300 Subject: [PATCH] fixed crash on move selection --- src/notation/internal/notationinteraction.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/notation/internal/notationinteraction.cpp b/src/notation/internal/notationinteraction.cpp index 3a4b3330aae82..0970fb97f2fbd 100644 --- a/src/notation/internal/notationinteraction.cpp +++ b/src/notation/internal/notationinteraction.cpp @@ -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()) { @@ -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) { + break; + } } + return currElem; };