1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 05:22:54 +08:00

Merge pull request #15533 from peppy/fix-realm-migration-crash

Fix realm migration potentially failing for users that haven't run osu! in a long time
This commit is contained in:
Bartłomiej Dach 2021-11-09 11:21:56 +01:00 committed by GitHub
commit 4aee2844f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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 metadataClassName = getMappedOrOriginalName(typeof(RealmBeatmapMetadata));
// May be coming from a version before `RealmBeatmapMetadata` existed.
if (!migration.OldRealm.Schema.TryFindObjectSchema(metadataClassName, out _))
return;
var oldMetadata = migration.OldRealm.DynamicApi.All(metadataClassName);
var newMetadata = migration.NewRealm.All<RealmBeatmapMetadata>();
int metadataCount = newMetadata.Count();