1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 06:07:25 +08:00

Merge pull request #11569 from peppy/fix-editor-new-beatmap-crash

Fix a potential crash when exiting the editor before a new beatmap is added to the database
This commit is contained in:
Dan Balasescu 2021-02-01 21:01:51 +09:00 committed by GitHub
commit c70dd2edfc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -109,7 +109,16 @@ namespace osu.Game.Screens.Edit
if (Beatmap.Value is DummyWorkingBeatmap)
{
isNewBeatmap = true;
Beatmap.Value = beatmapManager.CreateNew(Ruleset.Value, api.LocalUser.Value);
var newBeatmap = beatmapManager.CreateNew(Ruleset.Value, api.LocalUser.Value);
// this is a bit haphazard, but guards against setting the lease Beatmap bindable if
// the editor has already been exited.
if (!ValidForPush)
return;
// this probably shouldn't be set in the asynchronous load method, but everything following relies on it.
Beatmap.Value = newBeatmap;
}
beatDivisor.Value = Beatmap.Value.BeatmapInfo.BeatDivisor;