Skip to content

Commit

Permalink
fix #44801: crash on join of last measure
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcSabatella committed Jan 19, 2015
1 parent be86863 commit dd79c02
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions libmscore/select.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1052,10 +1052,15 @@ bool Selection::measureRange(Measure** m1, Measure** m2) const
if (!isRange())
return false;
*m1 = startSegment()->measure();
*m2 = endSegment()->measure();
if (m1 == m2)
Segment* s2 = endSegment();
*m2 = s2 ? s2->measure() : score()->lastMeasure();
if (*m1 == *m2)
return true;
if (*m2 && (*m2)->tick() == endSegment()->tick())
// if selection extends to last segment of a measure,
// then endSegment() will point to next measure
// this won't normally happen because end barlines are excluded from range selection
// but just in case, detect this and back up one measure
if (*m2 && s2 && (*m2)->tick() == s2->tick())
*m2 = (*m2)->prevMeasure();
return true;
}
Expand Down

0 comments on commit dd79c02

Please sign in to comment.