1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 21:27:24 +08:00

style: guard event handler unsubscriptions

This commit is contained in:
tsrk 2023-06-18 20:20:56 +02:00
parent 9c6c6bf1ea
commit 1a8219adf6
No known key found for this signature in database
GPG Key ID: EBD46BB3049B56D6
2 changed files with 10 additions and 3 deletions

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Bindables;
using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Screens.Play.HUD
@ -48,8 +49,11 @@ namespace osu.Game.Screens.Play.HUD
{
base.Dispose(isDisposing);
Trigger.OnActivate -= Activate;
Trigger.OnDeactivate -= Deactivate;
if (Trigger.IsNotNull())
{
Trigger.OnActivate -= Activate;
Trigger.OnDeactivate -= Deactivate;
}
}
}
}

View File

@ -5,6 +5,7 @@ using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Graphics.Containers;
using osu.Game.Configuration;
using osu.Game.Rulesets.UI;
@ -77,7 +78,9 @@ namespace osu.Game.Screens.Play.HUD
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
controller.OnNewTrigger -= Add;
if (controller.IsNotNull())
controller.OnNewTrigger -= Add;
}
public bool UsesFixedAnchor { get; set; }