Skip to content

Commit

Permalink
Fix #302573 - Crash undoing add instruments
Browse files Browse the repository at this point in the history
Root cause was in needViewportMove() which used the begin and end staff
from the cmdState but the state wasn't adapted for the removed staff yet.
  • Loading branch information
njvdberg committed Jun 8, 2020
1 parent cc50e7a commit 954aed8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mscore/scoreview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5276,8 +5276,9 @@ static bool needViewportMove(Score* cs, ScoreView* cv)
mEnd = mEnd ? mEnd->nextMeasureMM() : nullptr;

const bool isExcerpt = !cs->isMaster();
const int startStaff = (isExcerpt || state.startStaff() < 0) ? 0 : state.startStaff();
const int endStaff = (isExcerpt || state.endStaff() < 0) ? (cs->nstaves() - 1) : state.endStaff();
const bool csStaves = (isExcerpt || (state.endStaff() < 0) || (state.endStaff() >= cs->nstaves()));
const int startStaff = csStaves ? 0 : state.startStaff();
const int endStaff = csStaves ? (cs->nstaves() - 1) : state.endStaff();

for (Measure* m = mStart; m && m != mEnd; m = m->nextMeasureMM()) {
for (int st = startStaff; st <= endStaff; ++st) {
Expand Down

0 comments on commit 954aed8

Please sign in to comment.