mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 12:57:36 +08:00
Fix double binding causing game crash after API enters failing state
See https://sentry.ppy.sh/organizations/ppy/issues/33406/?alert_rule_id=4&alert_timestamp=1711655107332&alert_type=email&environment=production&project=2&referrer=alert_email
This commit is contained in:
parent
c51a2e169d
commit
fef8afb833
@ -30,7 +30,7 @@ namespace osu.Game.Overlays.Login
|
||||
[Resolved]
|
||||
private OsuColour colours { get; set; } = null!;
|
||||
|
||||
private UserDropdown dropdown = null!;
|
||||
private UserDropdown? dropdown;
|
||||
|
||||
/// <summary>
|
||||
/// Called to request a hide of a parent displaying this container.
|
||||
@ -68,6 +68,14 @@ namespace osu.Game.Overlays.Login
|
||||
apiState.BindValueChanged(onlineStateChanged, true);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
userStatus.BindTo(api.LocalUser.Value.Status);
|
||||
userStatus.BindValueChanged(e => updateDropdownCurrent(e.NewValue), true);
|
||||
}
|
||||
|
||||
private void onlineStateChanged(ValueChangedEvent<APIState> state) => Schedule(() =>
|
||||
{
|
||||
form = null;
|
||||
@ -144,9 +152,6 @@ namespace osu.Game.Overlays.Login
|
||||
},
|
||||
};
|
||||
|
||||
userStatus.BindTo(api.LocalUser.Value.Status);
|
||||
userStatus.BindValueChanged(e => updateDropdownCurrent(e.NewValue), true);
|
||||
|
||||
dropdown.Current.BindValueChanged(action =>
|
||||
{
|
||||
switch (action.NewValue)
|
||||
@ -171,6 +176,7 @@ namespace osu.Game.Overlays.Login
|
||||
break;
|
||||
}
|
||||
}, true);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@ -180,6 +186,9 @@ namespace osu.Game.Overlays.Login
|
||||
|
||||
private void updateDropdownCurrent(UserStatus? status)
|
||||
{
|
||||
if (dropdown == null)
|
||||
return;
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case UserStatus.Online:
|
||||
|
Loading…
Reference in New Issue
Block a user