13
0

prevent crash if tempo or meter are dragged back to zero

This commit is contained in:
Paul Davis 2022-10-25 12:52:30 -06:00
parent b0c162879d
commit 0ff2c746f7

View File

@ -1417,8 +1417,14 @@ TempoMap::move_tempo (TempoPoint const & tp, timepos_t const & when, bool push)
beats = beats.round_to_beat ();
for (t = _tempos.begin(), prev_t = _tempos.end(); t != _tempos.end() && t->beats() < beats && *t != tp; ++t) { prev_t = t; }
for (m = _meters.begin(), prev_m = _meters.end(); m != _meters.end() && m->beats() < beats; ++m) { prev_m = m; }
assert (prev_t != _tempos.end());
assert (prev_m != _meters.end());
if (prev_t == _tempos.end()) {
/* moved earlier than first, no movement */
return false;
}
if (prev_m == _meters.end()) {
/* moved earlier than first, no movement */
return false;
}
TempoMetric metric (*prev_t, *prev_m);
sc = metric.superclock_at (beats);
bbt = metric.bbt_at (beats);