From e7dcbddbeb4eb4febf48c79578c3d2595b27e765 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 15 Jun 2022 18:53:49 +0300 Subject: [PATCH] Fix potential null reference --- osu.Game/Overlays/NotificationOverlay.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/NotificationOverlay.cs b/osu.Game/Overlays/NotificationOverlay.cs index b772dffa73..1fe446454c 100644 --- a/osu.Game/Overlays/NotificationOverlay.cs +++ b/osu.Game/Overlays/NotificationOverlay.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System.Linq; +using JetBrains.Annotations; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -36,8 +37,10 @@ namespace osu.Game.Overlays private AudioManager audio { get; set; } [Resolved(canBeNull: true)] + [CanBeNull] private FirstRunSetupOverlay firstRunSetup { get; set; } + [CanBeNull] private IBindable firstRunSetupState; [BackgroundDependencyLoader] @@ -103,8 +106,10 @@ namespace osu.Game.Overlays State.ValueChanged += _ => updateProcessingMode(); - firstRunSetupState = firstRunSetup.State.GetBoundCopy(); - firstRunSetupState.ValueChanged += _ => updateProcessingMode(); + firstRunSetupState = firstRunSetup?.State.GetBoundCopy(); + + if (firstRunSetupState != null) + firstRunSetupState.ValueChanged += _ => updateProcessingMode(); OverlayActivationMode.BindValueChanged(_ => updateProcessingMode(), true); }