mirror of
https://github.com/ppy/osu.git
synced 2024-11-15 09:47:24 +08:00
Merge pull request #30620 from peppy/fix-offset-adjust-crash
Fix crash when resetting offset after a play with no hit events
This commit is contained in:
commit
d08c8ae482
@ -40,6 +40,13 @@ namespace osu.Game.Tests.Visual.Ranking
|
||||
AddSliderStep("height", 0.0f, 1000.0f, height.Value, height.Set);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestZeroEvents()
|
||||
{
|
||||
createTest(new List<HitEvent>());
|
||||
AddStep("update offset", () => graph.UpdateOffset(10));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestManyDistributedEventsOffset()
|
||||
{
|
||||
|
@ -176,7 +176,7 @@ namespace osu.Game.Screens.Ranking.Statistics
|
||||
for (int i = 1; i <= axis_points; i++)
|
||||
{
|
||||
double axisValue = i * axisValueStep;
|
||||
float position = (float)(axisValue / maxValue);
|
||||
float position = maxValue == 0 ? 0 : (float)(axisValue / maxValue);
|
||||
float alpha = 1f - position * 0.8f;
|
||||
|
||||
axisFlow.Add(new OsuSpriteText
|
||||
@ -348,7 +348,7 @@ namespace osu.Game.Screens.Ranking.Statistics
|
||||
boxAdjustment.FadeTo(!hasAdjustment ? 0 : 1, duration, Easing.OutQuint);
|
||||
}
|
||||
|
||||
private float offsetForValue(float value) => (1 - minimum_height) * value / maxValue;
|
||||
private float offsetForValue(float value) => maxValue == 0 ? 0 : (1 - minimum_height) * value / maxValue;
|
||||
|
||||
private float heightForValue(float value) => minimum_height + offsetForValue(value);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user