From e5392ff3dc4e22e24c4fb282334f4e65405c378e Mon Sep 17 00:00:00 2001 From: michioxd Date: Wed, 15 Oct 2025 16:06:42 +0700 Subject: [PATCH] Handle null if Sprites can't load in time --- osu!stream/GameModes/SongSelect/SongSelect.cs | 16 ++++++++++------ osu!stream/Graphics/Sprites/pSpriteCollection.cs | 6 +++++- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/osu!stream/GameModes/SongSelect/SongSelect.cs b/osu!stream/GameModes/SongSelect/SongSelect.cs index 2f3f0a6b..4a96c537 100644 --- a/osu!stream/GameModes/SongSelect/SongSelect.cs +++ b/osu!stream/GameModes/SongSelect/SongSelect.cs @@ -506,12 +506,16 @@ public override void Update() if (!AudioEngine.Music.IsElapsing) playFromPreview(); - SelectedPanelHoverGlow.Alpha = 1; - SelectedPanelHoverGlow.Colour = Color4.White; - SelectedPanelHoverGlow.FadeOut(500, 0.8f); - SelectedPanelHoverGlow.Transformations[0].Looping = true; - SelectedPanelHoverGlowLockedIn = SelectedPanelHoverGlow; - SelectedPanelHoverGlow = null; + if (SelectedPanelHoverGlow != null) + { + SelectedPanelHoverGlow.Alpha = 1; + SelectedPanelHoverGlow.Colour = Color4.White; + SelectedPanelHoverGlow.FadeOut(500, 0.8f); + SelectedPanelHoverGlow.Transformations[0].Looping = true; + SelectedPanelHoverGlowLockedIn = SelectedPanelHoverGlow; + SelectedPanelHoverGlow = null; + } + PreviewingPanel = panel; PreviewingPanel.Add(SelectedPanelHoverGlowLockedIn); } diff --git a/osu!stream/Graphics/Sprites/pSpriteCollection.cs b/osu!stream/Graphics/Sprites/pSpriteCollection.cs index 9bc46972..c502a5fb 100644 --- a/osu!stream/Graphics/Sprites/pSpriteCollection.cs +++ b/osu!stream/Graphics/Sprites/pSpriteCollection.cs @@ -49,7 +49,11 @@ internal void Add(pSpriteCollection sc) internal void MoveTo(Vector2 location, int duration) { //todo: this is horribly inefficient. - Sprites.ForEach(s => s.MoveTo(location, duration, EasingTypes.In)); + Sprites.ForEach(s => + { + if (s == null) return; + s.MoveTo(location, duration, EasingTypes.In); + }); } } } \ No newline at end of file