Fix potential null due to async load

This commit is contained in:
Dean Herbert 2020-03-11 16:07:44 +09:00
parent ec88f7a712
commit 6546fd3f81

View File

@ -46,7 +46,7 @@ namespace osu.Game.Tests.Visual.Menus
LoadScreen(loader);
});
AddAssert("spinner did not display", () => loader.LoadingSpinner.Alpha == 0);
AddAssert("spinner did not display", () => loader.LoadingSpinner?.Alpha == 0);
AddUntilStep("loaded", () => loader.ScreenLoaded);
AddUntilStep("not current", () => !loader.IsCurrentScreen());
@ -67,7 +67,7 @@ namespace osu.Game.Tests.Visual.Menus
{
public readonly ManualResetEventSlim AllowLoad = new ManualResetEventSlim();
public LoadingSpinner LoadingSpinner => this.ChildrenOfType<LoadingSpinner>().Single();
public LoadingSpinner LoadingSpinner => this.ChildrenOfType<LoadingSpinner>().FirstOrDefault();
private TestScreen screen;
public bool ScreenLoaded => screen.IsCurrentScreen();