From 33b76015d80df41618867a94227fbe2251bae200 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Sun, 6 Sep 2020 01:54:08 +0300 Subject: [PATCH] Fix MusicActionHandler unnecessarily depending on OnScreenDisplay's existance --- osu.Game/Overlays/Music/MusicActionHandler.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/Music/MusicActionHandler.cs b/osu.Game/Overlays/Music/MusicActionHandler.cs index 17aa4c1d32..cd8548c1c0 100644 --- a/osu.Game/Overlays/Music/MusicActionHandler.cs +++ b/osu.Game/Overlays/Music/MusicActionHandler.cs @@ -22,7 +22,7 @@ namespace osu.Game.Overlays.Music [Resolved] private MusicController musicController { get; set; } - [Resolved] + [Resolved(canBeNull: true)] private OnScreenDisplay onScreenDisplay { get; set; } public bool OnPressed(GlobalAction action) @@ -34,14 +34,14 @@ namespace osu.Game.Overlays.Music { case GlobalAction.MusicPlay: if (musicController.TogglePause()) - onScreenDisplay.Display(new MusicActionToast(musicController.IsPlaying ? "Play track" : "Pause track")); + onScreenDisplay?.Display(new MusicActionToast(musicController.IsPlaying ? "Play track" : "Pause track")); return true; case GlobalAction.MusicNext: musicController.NextTrack(() => { - onScreenDisplay.Display(new MusicActionToast("Next track")); + onScreenDisplay?.Display(new MusicActionToast("Next track")); }).RunTask(); return true; @@ -52,11 +52,11 @@ namespace osu.Game.Overlays.Music switch (res) { case PreviousTrackResult.Restart: - onScreenDisplay.Display(new MusicActionToast("Restart track")); + onScreenDisplay?.Display(new MusicActionToast("Restart track")); break; case PreviousTrackResult.Previous: - onScreenDisplay.Display(new MusicActionToast("Previous track")); + onScreenDisplay?.Display(new MusicActionToast("Previous track")); break; } }).RunTask();