1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 11:37:28 +08:00

Fix seeding screen buttons crashing the game if no match is selected

This commit is contained in:
Dean Herbert 2022-11-07 19:04:06 +09:00
parent 64f9d6c891
commit d77b6b3603

View File

@ -26,6 +26,9 @@ namespace osu.Game.Tournament.Screens.TeamIntro
private readonly Bindable<TournamentTeam> currentTeam = new Bindable<TournamentTeam>(); private readonly Bindable<TournamentTeam> currentTeam = new Bindable<TournamentTeam>();
private TourneyButton showFirstTeamButton;
private TourneyButton showSecondTeamButton;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
@ -46,13 +49,13 @@ namespace osu.Game.Tournament.Screens.TeamIntro
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
new TourneyButton showFirstTeamButton = new TourneyButton
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Text = "Show first team", Text = "Show first team",
Action = () => currentTeam.Value = CurrentMatch.Value.Team1.Value, Action = () => currentTeam.Value = CurrentMatch.Value.Team1.Value,
}, },
new TourneyButton showSecondTeamButton = new TourneyButton
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Text = "Show second team", Text = "Show second team",
@ -86,7 +89,14 @@ namespace osu.Game.Tournament.Screens.TeamIntro
base.CurrentMatchChanged(match); base.CurrentMatchChanged(match);
if (match.NewValue == null) if (match.NewValue == null)
{
showFirstTeamButton.Enabled.Value = false;
showSecondTeamButton.Enabled.Value = false;
return; return;
}
showFirstTeamButton.Enabled.Value = true;
showSecondTeamButton.Enabled.Value = true;
currentTeam.Value = match.NewValue.Team1.Value; currentTeam.Value = match.NewValue.Team1.Value;
} }