Skip to content

Commit

Permalink
Merge pull request #20131 from Eism/grace_notes_navigation_fix
Browse files Browse the repository at this point in the history
fixed #20130: Crash when navigating grace note after main note at the end of measure with Alt+Right arrow
  • Loading branch information
DmitryArefiev committed Nov 21, 2023
2 parents 50cd91f + d8e1922 commit acb1bad
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
5 changes: 4 additions & 1 deletion src/engraving/dom/chord.cpp
Expand Up @@ -2796,7 +2796,10 @@ EngravingItem* Chord::prevElement()

ChordRest* next = prevChordRest(this);
if (next) {
return toChord(next)->notes().back();
if (next->isChord()) {
return toChord(next)->notes().back();
}
return toRest(next);
}
}
}
Expand Down
5 changes: 0 additions & 5 deletions src/engraving/dom/note.cpp
Expand Up @@ -3270,11 +3270,6 @@ EngravingItem* Note::nextElement()
if (graceNotesAfterFirstChord) {
return graceNotesAfterFirstChord->notes().front();
}
} else if (isGrace()) {
ChordRest* next = nextChordRest(chord());
if (next) {
return toChord(next)->notes().front();
}
}

if (!m_el.empty()) {
Expand Down
5 changes: 4 additions & 1 deletion src/engraving/dom/segment.cpp
Expand Up @@ -1667,7 +1667,10 @@ EngravingItem* Segment::prevElementOfSegment(Segment* s, EngravingItem* e, staff
if (!graceNotesBefore.empty()) {
ChordRest* next = prevChordRest(chord);
if (next) {
return toChord(next)->notes().back();
if (next->isChord()) {
return toChord(next)->notes().back();
}
return toRest(next);
}
}

Expand Down

0 comments on commit acb1bad

Please sign in to comment.