Merge pull request #11379 from peppy/fix-perform-from-menu-nullref

Fix PerformFromMenuRunner failing if CurrentScreen is null
This commit is contained in:
Dean Herbert 2020-12-31 19:10:21 +09:00 committed by GitHub
commit ec75efe124
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -73,15 +73,19 @@ namespace osu.Game
// find closest valid target
IScreen current = getCurrentScreen();
if (current == null)
return;
// a dialog may be blocking the execution for now.
if (checkForDialog(current)) return;
game?.CloseAllOverlays(false);
// we may already be at the target screen type.
if (validScreens.Contains(getCurrentScreen().GetType()) && !beatmap.Disabled)
if (validScreens.Contains(current.GetType()) && !beatmap.Disabled)
{
complete();
finalAction(current);
Cancel();
return;
}
@ -135,11 +139,5 @@ namespace osu.Game
lastEncounteredDialogScreen = current;
return true;
}
private void complete()
{
finalAction(getCurrentScreen());
Cancel();
}
}
}