diff --git a/osu.Game/Beatmaps/BeatmapMetadata.cs b/osu.Game/Beatmaps/BeatmapMetadata.cs index a3385e3abe..cb38373bd3 100644 --- a/osu.Game/Beatmaps/BeatmapMetadata.cs +++ b/osu.Game/Beatmaps/BeatmapMetadata.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using JetBrains.Annotations; using Newtonsoft.Json; using osu.Framework.Testing; using osu.Game.Models; @@ -27,7 +28,7 @@ namespace osu.Game.Beatmaps [JsonProperty("artist_unicode")] public string ArtistUnicode { get; set; } = string.Empty; - public RealmUser Author { get; set; } = new RealmUser(); // TODO: not sure we want to initialise this only to have it overwritten by retrieval. + public RealmUser Author { get; set; } = null!; public string Source { get; set; } = string.Empty; @@ -43,6 +44,16 @@ namespace osu.Game.Beatmaps public string AudioFile { get; set; } = string.Empty; public string BackgroundFile { get; set; } = string.Empty; + public BeatmapMetadata(RealmUser? user = null) + { + Author = new RealmUser(); + } + + [UsedImplicitly] // Realm + private BeatmapMetadata() + { + } + IUser IBeatmapMetadataInfo.Author => Author; public override string ToString() => this.GetDisplayTitle();