diff --git a/osu.Game.Tests/Editing/Checks/CheckBackgroundQualityTest.cs b/osu.Game.Tests/Editing/Checks/CheckBackgroundQualityTest.cs index 3424cfe732..2918dde2db 100644 --- a/osu.Game.Tests/Editing/Checks/CheckBackgroundQualityTest.cs +++ b/osu.Game.Tests/Editing/Checks/CheckBackgroundQualityTest.cs @@ -53,7 +53,7 @@ namespace osu.Game.Tests.Editing.Checks public void TestMissing() { // While this is a problem, it is out of scope for this check and is caught by a different one. - beatmap.Metadata.BackgroundFile = null; + beatmap.Metadata.BackgroundFile = string.Empty; var context = getContext(null, System.Array.Empty()); Assert.That(check.Run(context), Is.Empty); diff --git a/osu.Game.Tests/Editing/Checks/CheckFilePresenceTest.cs b/osu.Game.Tests/Editing/Checks/CheckFilePresenceTest.cs index 39a1d76d83..70e4c76b19 100644 --- a/osu.Game.Tests/Editing/Checks/CheckFilePresenceTest.cs +++ b/osu.Game.Tests/Editing/Checks/CheckFilePresenceTest.cs @@ -65,7 +65,7 @@ namespace osu.Game.Tests.Editing.Checks [Test] public void TestBackgroundNotSet() { - beatmap.Metadata.BackgroundFile = null; + beatmap.Metadata.BackgroundFile = string.Empty; var context = new BeatmapVerifierContext(beatmap, new TestWorkingBeatmap(beatmap)); var issues = check.Run(context).ToList(); diff --git a/osu.Game.Tests/NonVisual/Filtering/FilterMatchingTest.cs b/osu.Game.Tests/NonVisual/Filtering/FilterMatchingTest.cs index ed86daf8b6..41939cec3f 100644 --- a/osu.Game.Tests/NonVisual/Filtering/FilterMatchingTest.cs +++ b/osu.Game.Tests/NonVisual/Filtering/FilterMatchingTest.cs @@ -189,7 +189,7 @@ namespace osu.Game.Tests.NonVisual.Filtering public void TestCriteriaMatchingArtistWithNullUnicodeName(string artistName, bool filtered) { var exampleBeatmapInfo = getExampleBeatmap(); - exampleBeatmapInfo.Metadata.ArtistUnicode = null; + exampleBeatmapInfo.Metadata.ArtistUnicode = string.Empty; var criteria = new FilterCriteria { diff --git a/osu.Game.Tests/Visual/Editing/TestSceneMetadataSection.cs b/osu.Game.Tests/Visual/Editing/TestSceneMetadataSection.cs index 19081f3281..4621436cc6 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneMetadataSection.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneMetadataSection.cs @@ -23,10 +23,10 @@ namespace osu.Game.Tests.Visual.Editing AddStep("set metadata", () => { editorBeatmap.Metadata.Artist = "Example Artist"; - editorBeatmap.Metadata.ArtistUnicode = null; + editorBeatmap.Metadata.ArtistUnicode = string.Empty; editorBeatmap.Metadata.Title = "Example Title"; - editorBeatmap.Metadata.TitleUnicode = null; + editorBeatmap.Metadata.TitleUnicode = string.Empty; }); createSection(); @@ -44,10 +44,10 @@ namespace osu.Game.Tests.Visual.Editing AddStep("set metadata", () => { editorBeatmap.Metadata.ArtistUnicode = "*なみりん"; - editorBeatmap.Metadata.Artist = null; + editorBeatmap.Metadata.Artist = string.Empty; editorBeatmap.Metadata.TitleUnicode = "コイシテイク・プラネット"; - editorBeatmap.Metadata.Title = null; + editorBeatmap.Metadata.Title = string.Empty; }); createSection(); @@ -86,10 +86,10 @@ namespace osu.Game.Tests.Visual.Editing AddStep("set metadata", () => { editorBeatmap.Metadata.ArtistUnicode = "*なみりん"; - editorBeatmap.Metadata.Artist = null; + editorBeatmap.Metadata.Artist = string.Empty; editorBeatmap.Metadata.TitleUnicode = "コイシテイク・プラネット"; - editorBeatmap.Metadata.Title = null; + editorBeatmap.Metadata.Title = string.Empty; }); createSection(); diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayRecording.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayRecording.cs index 3545fc96e8..08578168d6 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayRecording.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayRecording.cs @@ -54,7 +54,7 @@ namespace osu.Game.Tests.Visual.Gameplay ScoreInfo = { BeatmapInfo = gameplayState.Beatmap.BeatmapInfo } }) { - ScreenSpaceToGamefield = pos => recordingManager.ToLocalSpace(pos) + ScreenSpaceToGamefield = pos => recordingManager?.ToLocalSpace(pos) ?? Vector2.Zero, }, Child = new Container { @@ -84,7 +84,7 @@ namespace osu.Game.Tests.Visual.Gameplay { ReplayInputHandler = new TestFramedReplayInputHandler(replay) { - GamefieldToScreenSpace = pos => playbackManager.ToScreenSpace(pos), + GamefieldToScreenSpace = pos => playbackManager?.ToScreenSpace(pos) ?? Vector2.Zero, }, Child = new Container { diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs index 5940911d4a..8a5dde961f 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs @@ -142,7 +142,7 @@ namespace osu.Game.Screens.Select.Carousel }, new OsuSpriteText { - Text = $"{(beatmapInfo.Metadata ?? beatmapInfo.BeatmapSet.Metadata).Author.Username}", + Text = $"{(beatmapInfo.Metadata ?? beatmapInfo.BeatmapSet.Metadata).Author?.Username ?? string.Empty}", Font = OsuFont.GetFont(italics: true), Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft diff --git a/osu.Game/Storyboards/Storyboard.cs b/osu.Game/Storyboards/Storyboard.cs index a25bf24491..99123627bd 100644 --- a/osu.Game/Storyboards/Storyboard.cs +++ b/osu.Game/Storyboards/Storyboard.cs @@ -77,8 +77,8 @@ namespace osu.Game.Storyboards { get { - string backgroundPath = BeatmapInfo.BeatmapSet?.Metadata?.BackgroundFile?.ToLowerInvariant(); - if (backgroundPath == null) + string backgroundPath = BeatmapInfo.BeatmapSet?.Metadata?.BackgroundFile.ToLowerInvariant(); + if (string.IsNullOrEmpty(backgroundPath)) return false; return GetLayer("Background").Elements.Any(e => e.Path.ToLowerInvariant() == backgroundPath);