Merge pull request #16282 from peppy/fix-kiai-drawable-nullref

Fix null reference causing crash in `KiaiFlashingDrawable`
This commit is contained in:
Bartłomiej Dach 2021-12-30 23:43:58 +01:00 committed by GitHub
commit cbb62fab26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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<Drawable> creationFunc)
public KiaiFlashingDrawable(Func<Drawable?> 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;