1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 05:32:54 +08:00

Merge pull request #25016 from peppy/fix-waveform-comparison-crash

Fix `WaveformComparisonDisplay` potentially crashing on invalid track length
This commit is contained in:
Bartłomiej Dach 2023-10-05 20:02:44 +02:00 committed by GitHub
commit 4d315cb718
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -94,7 +94,7 @@ namespace osu.Game.Screens.Edit.Timing
controlPointGroups.BindTo(editorBeatmap.ControlPointInfo.Groups);
controlPointGroups.BindCollectionChanged((_, _) => updateTimingGroup());
beatLength.BindValueChanged(_ => regenerateDisplay(true), true);
beatLength.BindValueChanged(_ => Scheduler.AddOnce(regenerateDisplay, true), true);
displayLocked.BindValueChanged(locked =>
{
@ -186,11 +186,18 @@ namespace osu.Game.Screens.Edit.Timing
return;
displayedTime = time;
regenerateDisplay(animated);
Scheduler.AddOnce(regenerateDisplay, animated);
}
private void regenerateDisplay(bool animated)
{
// Before a track is loaded, it won't have a valid length, which will break things.
if (!beatmap.Value.Track.IsLoaded)
{
Scheduler.AddOnce(regenerateDisplay, animated);
return;
}
double index = (displayedTime - selectedGroupStartTime) / timingPoint.BeatLength;
// Chosen as a pretty usable number across all BPMs.