From 71c0216c559449c8286a816d0d592ebaad41fdfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 7 Apr 2022 21:37:42 +0200 Subject: [PATCH] Add null check guards to unsubscriptions in `Dispose()` --- osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs | 4 +++- osu.Game/Storyboards/Drawables/DrawableStoryboardSprite.cs | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs index 5ebca4d860..8a14b8b183 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs @@ -133,7 +133,9 @@ namespace osu.Game.Storyboards.Drawables protected override void Dispose(bool isDisposing) { base.Dispose(isDisposing); - skin.SourceChanged -= skinSourceChanged; + + if (skin != null) + skin.SourceChanged -= skinSourceChanged; } } } diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboardSprite.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboardSprite.cs index 6622cfb6be..a6f2b8fcbd 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboardSprite.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboardSprite.cs @@ -110,7 +110,9 @@ namespace osu.Game.Storyboards.Drawables protected override void Dispose(bool isDisposing) { base.Dispose(isDisposing); - skin.SourceChanged -= skinSourceChanged; + + if (skin != null) + skin.SourceChanged -= skinSourceChanged; } } }