From 408e8d57109ed44498601f02c829d6b4faa8c05d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 30 Dec 2021 22:21:37 +0900 Subject: [PATCH] Fix null reference causing crash in `KiaiFlashingDrawable` Can occur if there is no fallback graphics available. Previously would work as it was only setting the `Texture`. As reported in https://github.com/ppy/osu/discussions/16281. --- .../Skinning/Legacy/KiaiFlashingDrawable.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/KiaiFlashingDrawable.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/KiaiFlashingDrawable.cs index cd1d05c985..4ee28d05b5 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/KiaiFlashingDrawable.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/KiaiFlashingDrawable.cs @@ -7,6 +7,8 @@ using osu.Framework.Graphics; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Graphics.Containers; +#nullable enable + namespace osu.Game.Rulesets.Osu.Skinning.Legacy { internal class KiaiFlashingDrawable : BeatSyncedContainer @@ -15,18 +17,18 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy private const float flash_opacity = 0.3f; - public KiaiFlashingDrawable(Func creationFunc) + public KiaiFlashingDrawable(Func creationFunc) { AutoSizeAxes = Axes.Both; Children = new[] { - creationFunc.Invoke().With(d => + (creationFunc.Invoke() ?? Empty()).With(d => { d.Anchor = Anchor.Centre; d.Origin = Anchor.Centre; }), - flashingDrawable = creationFunc.Invoke().With(d => + flashingDrawable = (creationFunc.Invoke() ?? Empty()).With(d => { d.Anchor = Anchor.Centre; d.Origin = Anchor.Centre;