From 7f5be964c471bcc87e208c021755f772433709a0 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Wed, 14 Feb 2024 22:40:05 +0000 Subject: [PATCH] fix: null-check avatar on leave event --- VPLink/Services/AvatarService.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/VPLink/Services/AvatarService.cs b/VPLink/Services/AvatarService.cs index 8f90ef2..24449f3 100644 --- a/VPLink/Services/AvatarService.cs +++ b/VPLink/Services/AvatarService.cs @@ -63,6 +63,10 @@ internal sealed class AvatarService : BackgroundService, IAvatarService private void OnVPAvatarLeft(VirtualParadiseAvatar avatar) { + // ReSharper disable once ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract + if (avatar is null) + return; + _logger.LogInformation("{Avatar} left ({User})", avatar, avatar.User); IBotConfiguration configuration = _configurationService.BotConfiguration;