Fix song select.

This commit is contained in:
Dean Herbert 2017-04-18 10:04:32 +09:00
parent d3c1520a2d
commit f2174054ea
No known key found for this signature in database
GPG Key ID: 46D71BF4958ABB49
2 changed files with 12 additions and 5 deletions

View File

@ -271,12 +271,14 @@ public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, WorkingBeatmap
{
var beatmapSetInfo = Query<BeatmapSetInfo>().FirstOrDefault(s => s.ID == beatmapInfo.BeatmapSetInfoID);
//we need metadata
GetChildren(beatmapSetInfo);
if (beatmapSetInfo == null)
throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetInfoID} is not in the local database.");
//we need metadata
GetChildren(beatmapSetInfo);
foreach (var b in beatmapSetInfo.Beatmaps)
GetChildren(b);
if (beatmapInfo.Metadata == null)
beatmapInfo.Metadata = beatmapSetInfo.Metadata;

View File

@ -145,7 +145,7 @@ public void SelectNext(int direction = 1, bool skipDifficulties = true)
}
}
int startIndex = groups.IndexOf(selectedGroup);
int startIndex = Math.Max(0, groups.IndexOf(selectedGroup));
int index = startIndex;
do
@ -221,7 +221,12 @@ public void Filter(FilterCriteria newCriteria = null, bool debounce = true)
private BeatmapGroup createGroup(BeatmapSetInfo beatmapSet)
{
database.GetChildren(beatmapSet);
beatmapSet.Beatmaps.ForEach(b => { if (b.Metadata == null) b.Metadata = beatmapSet.Metadata; });
beatmapSet.Beatmaps.ForEach(b =>
{
database.GetChildren(b);
if (b.Metadata == null)
b.Metadata = beatmapSet.Metadata;
});
return new BeatmapGroup(beatmapSet, database)
{