From 51a1721bc942b71b768faae474d1a2eaa52a1dc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Tue, 22 Mar 2022 22:10:05 +0100 Subject: [PATCH] Fix unprotected access to potentially-null DI'd dialog overlay --- osu.Game/Tests/Visual/EditorTestScene.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Tests/Visual/EditorTestScene.cs b/osu.Game/Tests/Visual/EditorTestScene.cs index efaf6f2253..51221cb8fe 100644 --- a/osu.Game/Tests/Visual/EditorTestScene.cs +++ b/osu.Game/Tests/Visual/EditorTestScene.cs @@ -97,6 +97,7 @@ namespace osu.Game.Tests.Visual protected class TestEditor : Editor { [Resolved(canBeNull: true)] + [CanBeNull] private DialogOverlay dialogOverlay { get; set; } public new void Undo() => base.Undo(); @@ -120,7 +121,7 @@ namespace osu.Game.Tests.Visual public override bool OnExiting(IScreen next) { // For testing purposes allow the screen to exit without saving on second attempt. - if (!ExitConfirmed && dialogOverlay.CurrentDialog is PromptForSaveDialog saveDialog) + if (!ExitConfirmed && dialogOverlay?.CurrentDialog is PromptForSaveDialog saveDialog) { saveDialog.PerformAction(); return true;