1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 01:02:55 +08:00

Fix calling SkinEditorOverlay.Show before the overlay is loaded causing an exception

As seen at https://github.com/ppy/osu/runs/4652969942?check_suite_focus=true.
This commit is contained in:
Dean Herbert 2021-12-29 21:17:44 +09:00
parent f78adbea36
commit 471eea750a

View File

@ -73,9 +73,13 @@ namespace osu.Game.Skinning.Editor
skinEditor = new SkinEditor(target);
skinEditor.State.BindValueChanged(editorVisibilityChanged);
Debug.Assert(skinEditor != null);
LoadComponentAsync(skinEditor, AddInternal);
// Schedule ensures that if `Show` is called before this overlay is loaded,
// it will not throw (LoadComponentAsync requires the load target to be in a loaded state).
Schedule(() =>
{
Debug.Assert(skinEditor != null);
LoadComponentAsync(skinEditor, AddInternal);
});
}
else
skinEditor.Show();