mirror of
https://github.com/osukey/osukey.git
synced 2025-06-05 12:57:39 +09:00
Merge pull request #10334 from peppy/fix-editor-current-time-button-crash
Protect "use current time" button against crash when no timing point is selected
This commit is contained in:
commit
36dbb1b70a
@ -18,6 +18,8 @@ namespace osu.Game.Screens.Edit.Timing
|
|||||||
{
|
{
|
||||||
private LabelledTextBox textBox;
|
private LabelledTextBox textBox;
|
||||||
|
|
||||||
|
private TriangleButton button;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
protected Bindable<ControlPointGroup> SelectedGroup { get; private set; }
|
protected Bindable<ControlPointGroup> SelectedGroup { get; private set; }
|
||||||
|
|
||||||
@ -52,7 +54,7 @@ namespace osu.Game.Screens.Edit.Timing
|
|||||||
{
|
{
|
||||||
Label = "Time"
|
Label = "Time"
|
||||||
},
|
},
|
||||||
new TriangleButton
|
button = new TriangleButton
|
||||||
{
|
{
|
||||||
Text = "Use current time",
|
Text = "Use current time",
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
@ -82,18 +84,22 @@ namespace osu.Game.Screens.Edit.Timing
|
|||||||
if (group.NewValue == null)
|
if (group.NewValue == null)
|
||||||
{
|
{
|
||||||
textBox.Text = string.Empty;
|
textBox.Text = string.Empty;
|
||||||
|
|
||||||
textBox.Current.Disabled = true;
|
textBox.Current.Disabled = true;
|
||||||
|
button.Enabled.Value = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
textBox.Current.Disabled = false;
|
textBox.Current.Disabled = false;
|
||||||
|
button.Enabled.Value = true;
|
||||||
|
|
||||||
textBox.Text = $"{group.NewValue.Time:n0}";
|
textBox.Text = $"{group.NewValue.Time:n0}";
|
||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void changeSelectedGroupTime(in double time)
|
private void changeSelectedGroupTime(in double time)
|
||||||
{
|
{
|
||||||
if (time == SelectedGroup.Value.Time)
|
if (SelectedGroup.Value == null || time == SelectedGroup.Value.Time)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
changeHandler?.BeginChange();
|
changeHandler?.BeginChange();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user