Skip to content

Commit

Permalink
Merge branch 'bpm-crash' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
niet-dev committed Mar 8, 2024
2 parents d8373f3 + e92f4a4 commit 6ccb209
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Etterna/Models/Misc/TimingData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1409,8 +1409,6 @@ TimingData::BuildAndGetEtaner(const std::vector<int>& nerv)
event_row = bpms[i]->GetRow();
time_to_next_event = NoteRowToBeat(event_row - lastbpmrow) / bps;
const auto next_event_time = last_time + time_to_next_event;
if (bps <= 0)
Locator::getLogger()->fatal("Found {} bps in file {} - Very likely to crash.", bps, m_sFile);
while (idx < nerv.size() && nerv[idx] <= event_row) {
const auto perc = static_cast<float>(nerv[idx] - lastbpmrow) /
static_cast<float>(event_row - lastbpmrow);
Expand All @@ -1423,6 +1421,11 @@ TimingData::BuildAndGetEtaner(const std::vector<int>& nerv)
}
last_time = next_event_time;
bps = ToBPM(bpms[i])->GetBPM() / 60.f;
// set any 0 bpm segments to the previous segment's bpm
if (bps <= 0) {
ToBPM(bpms[i])->SetBPM(ToBPM(bpms[i - 1])->GetBPM());
bps = ToBPM(bpms[i])->GetBPM() / 60.f;
}
lastbpmrow = event_row;
}

Expand Down

0 comments on commit 6ccb209

Please sign in to comment.