diff --git a/osu.Game/Screens/Edit/Setup/ResourcesSection.cs b/osu.Game/Screens/Edit/Setup/ResourcesSection.cs index 5399f1fd6f..b3c80d8daa 100644 --- a/osu.Game/Screens/Edit/Setup/ResourcesSection.cs +++ b/osu.Game/Screens/Edit/Setup/ResourcesSection.cs @@ -10,9 +10,9 @@ using osu.Framework.Graphics; using osu.Framework.Localisation; using osu.Framework.Logging; using osu.Game.Beatmaps; -using osu.Game.Overlays; using osu.Game.Localisation; using osu.Game.Models; +using osu.Game.Overlays; using osu.Game.Screens.Backgrounds; using osu.Game.Utils; @@ -98,11 +98,16 @@ namespace osu.Game.Screens.Edit.Setup if (!source.Exists) return false; - TagLib.File? tagSource; + string artist; + string title; try { - tagSource = TagLibUtils.GetTagLibFile(source.FullName); + using (var tagSource = TagLibUtils.GetTagLibFile(source.FullName)) + { + artist = tagSource.Tag.JoinedAlbumArtists; + title = tagSource.Tag.Title; + } } catch (Exception e) { @@ -116,16 +121,12 @@ namespace osu.Game.Screens.Edit.Setup { metadata.AudioFile = name; - string artist = tagSource.Tag.JoinedAlbumArtists; - if (!string.IsNullOrWhiteSpace(artist)) { metadata.ArtistUnicode = artist; metadata.Artist = MetadataUtils.StripNonRomanisedCharacters(metadata.ArtistUnicode); } - string title = tagSource.Tag.Title; - if (!string.IsNullOrEmpty(title)) { metadata.TitleUnicode = title;