mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 10:12: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:
commit
4d315cb718
@ -94,7 +94,7 @@ namespace osu.Game.Screens.Edit.Timing
|
|||||||
controlPointGroups.BindTo(editorBeatmap.ControlPointInfo.Groups);
|
controlPointGroups.BindTo(editorBeatmap.ControlPointInfo.Groups);
|
||||||
controlPointGroups.BindCollectionChanged((_, _) => updateTimingGroup());
|
controlPointGroups.BindCollectionChanged((_, _) => updateTimingGroup());
|
||||||
|
|
||||||
beatLength.BindValueChanged(_ => regenerateDisplay(true), true);
|
beatLength.BindValueChanged(_ => Scheduler.AddOnce(regenerateDisplay, true), true);
|
||||||
|
|
||||||
displayLocked.BindValueChanged(locked =>
|
displayLocked.BindValueChanged(locked =>
|
||||||
{
|
{
|
||||||
@ -186,11 +186,18 @@ namespace osu.Game.Screens.Edit.Timing
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
displayedTime = time;
|
displayedTime = time;
|
||||||
regenerateDisplay(animated);
|
Scheduler.AddOnce(regenerateDisplay, animated);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void regenerateDisplay(bool 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;
|
double index = (displayedTime - selectedGroupStartTime) / timingPoint.BeatLength;
|
||||||
|
|
||||||
// Chosen as a pretty usable number across all BPMs.
|
// Chosen as a pretty usable number across all BPMs.
|
||||||
|
Loading…
Reference in New Issue
Block a user