Fix unprotected access to potentially-null DI'd dialog overlay

This commit is contained in:
Bartłomiej Dach 2022-03-22 22:10:05 +01:00
parent f3aad77239
commit 51a1721bc9
No known key found for this signature in database
GPG Key ID: BCECCD4FA41F6497

View File

@ -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<PopupDialogDangerousButton>();
return true;