Fix incorrect nesting of statements causing completely broken logic

This commit is contained in:
Dean Herbert 2022-01-23 17:51:32 +09:00
parent 33d3a10708
commit a5493ce0d1

View File

@ -99,18 +99,19 @@ namespace osu.Game.Screens.Menu
{ {
realmContextFactory.Run(realm => realmContextFactory.Run(realm =>
{ {
var sets = realm.All<BeatmapSetInfo>().Where(s => !s.DeletePending && !s.Protected).AsRealmCollection(); var usableBeatmapSets = realm.All<BeatmapSetInfo>().Where(s => !s.DeletePending && !s.Protected).AsRealmCollection();
int setCount = sets.Count; int setCount = usableBeatmapSets.Count;
if (setCount > 0) if (setCount > 0)
{ {
var found = sets[RNG.Next(0, setCount - 1)].Beatmaps.FirstOrDefault(); var found = usableBeatmapSets[RNG.Next(0, setCount - 1)].Beatmaps.FirstOrDefault();
if (found != null) if (found != null)
initialBeatmap = beatmaps.GetWorkingBeatmap(found); initialBeatmap = beatmaps.GetWorkingBeatmap(found);
} }
}); });
}
// we generally want a song to be playing on startup, so use the intro music even if a user has specified not to if no other track is available. // we generally want a song to be playing on startup, so use the intro music even if a user has specified not to if no other track is available.
if (initialBeatmap == null) if (initialBeatmap == null)
@ -145,7 +146,6 @@ namespace osu.Game.Screens.Menu
return UsingThemedIntro = initialBeatmap != null; return UsingThemedIntro = initialBeatmap != null;
} }
} }
}
public override void OnResuming(IScreen last) public override void OnResuming(IScreen last)
{ {