1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 14:17:26 +08:00

Fix realm migration potentially failing for users that haven't run osu! in a long time

As reported at https://github.com/ppy/osu/discussions/15530.
This commit is contained in:
Dean Herbert 2021-11-09 14:51:06 +09:00
parent 0f129b2cfb
commit 999d625e76

View File

@ -209,7 +209,13 @@ namespace osu.Game.Database
case 9:
// Pretty pointless to do this as beatmaps aren't really loaded via realm yet, but oh well.
var oldMetadata = migration.OldRealm.DynamicApi.All(getMappedOrOriginalName(typeof(RealmBeatmapMetadata)));
string className = getMappedOrOriginalName(typeof(RealmBeatmapMetadata));
// May be coming from a version before `RealmBeatmapMetadata` existed.
if (!migration.OldRealm.Schema.TryFindObjectSchema(className, out _))
return;
var oldMetadata = migration.OldRealm.DynamicApi.All(className);
var newMetadata = migration.NewRealm.All<RealmBeatmapMetadata>();
int metadataCount = newMetadata.Count();