1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-26 08:02:55 +08:00

Merge pull request #16645 from peppy/fix-button-system-crash

Fix `ButtonSystem` null reference crash due to missing null check in delayed animations
This commit is contained in:
Dean Herbert 2022-01-27 17:09:46 +09:00 committed by GitHub
commit df9f969030
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,6 +4,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using JetBrains.Annotations;
using osu.Framework; using osu.Framework;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Audio; using osu.Framework.Audio;
@ -49,6 +50,7 @@ namespace osu.Game.Screens.Menu
public const float BUTTON_WIDTH = 140f; public const float BUTTON_WIDTH = 140f;
public const float WEDGE_WIDTH = 20; public const float WEDGE_WIDTH = 20;
[CanBeNull]
private OsuLogo logo; private OsuLogo logo;
/// <summary> /// <summary>
@ -328,9 +330,9 @@ namespace osu.Game.Screens.Menu
game?.Toolbar.Hide(); game?.Toolbar.Hide();
logo.ClearTransforms(targetMember: nameof(Position)); logo?.ClearTransforms(targetMember: nameof(Position));
logo.MoveTo(new Vector2(0.5f), 800, Easing.OutExpo); logo?.MoveTo(new Vector2(0.5f), 800, Easing.OutExpo);
logo.ScaleTo(1, 800, Easing.OutExpo); logo?.ScaleTo(1, 800, Easing.OutExpo);
}, buttonArea.Alpha * 150); }, buttonArea.Alpha * 150);
break; break;
@ -354,7 +356,7 @@ namespace osu.Game.Screens.Menu
logoDelayedAction = Scheduler.AddDelayed(() => logoDelayedAction = Scheduler.AddDelayed(() =>
{ {
if (impact) if (impact)
logo.Impact(); logo?.Impact();
game?.Toolbar.Show(); game?.Toolbar.Show();
}, 200); }, 200);