Skip scores missing beatmaps during realm migration

This commit is contained in:
Dean Herbert 2022-01-28 01:20:32 +09:00
parent 96f86d035d
commit 942ea896f1
1 changed files with 3 additions and 3 deletions

View File

@ -374,12 +374,12 @@ private void migrateScores(OsuDbContext db)
log($"Migrated {written}/{count} scores...");
}
var beatmap = r.All<BeatmapInfo>().First(b => b.Hash == score.BeatmapInfo.Hash);
var beatmap = r.All<BeatmapInfo>().FirstOrDefault(b => b.Hash == score.BeatmapInfo.Hash);
var ruleset = r.Find<RulesetInfo>(score.Ruleset.ShortName);
if (ruleset == null)
if (beatmap == null || ruleset == null)
{
log($"Skipping {++missing} scores with missing ruleset");
log($"Skipping {++missing} scores with missing ruleset or beatmap");
continue;
}