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

Fix nullref in tests

This commit is contained in:
Dan Balasescu 2022-02-25 16:12:25 +09:00
parent 48ed9c6144
commit 387ae59bc4

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using JetBrains.Annotations;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
@ -15,10 +16,11 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
{ {
public class GameplayChatDisplay : MatchChatDisplay, IKeyBindingHandler<GlobalAction> public class GameplayChatDisplay : MatchChatDisplay, IKeyBindingHandler<GlobalAction>
{ {
[Resolved] [Resolved(CanBeNull = true)]
[CanBeNull]
private ILocalUserPlayInfo localUserInfo { get; set; } private ILocalUserPlayInfo localUserInfo { get; set; }
private IBindable<bool> localUserPlaying = new Bindable<bool>(); private readonly IBindable<bool> localUserPlaying = new Bindable<bool>();
public override bool PropagatePositionalInputSubTree => !localUserPlaying.Value; public override bool PropagatePositionalInputSubTree => !localUserPlaying.Value;
@ -46,7 +48,9 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
{ {
base.LoadComplete(); base.LoadComplete();
localUserPlaying = localUserInfo.IsPlaying.GetBoundCopy(); if (localUserInfo != null)
localUserPlaying.BindTo(localUserInfo.IsPlaying);
localUserPlaying.BindValueChanged(playing => localUserPlaying.BindValueChanged(playing =>
{ {
// for now let's never hold focus. this avoid misdirected gameplay keys entering chat. // for now let's never hold focus. this avoid misdirected gameplay keys entering chat.