From 8eca8e1dfb777530349a2fd225e8842f93ae9057 Mon Sep 17 00:00:00 2001 From: Kwoth Date: Mon, 18 Jul 2022 04:45:05 +0200 Subject: [PATCH] Avoid awaiting possible null --- src/NadekoBot/Modules/Xp/XpService.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/NadekoBot/Modules/Xp/XpService.cs b/src/NadekoBot/Modules/Xp/XpService.cs index f196d402a..f53d892dd 100644 --- a/src/NadekoBot/Modules/Xp/XpService.cs +++ b/src/NadekoBot/Modules/Xp/XpService.cs @@ -341,10 +341,13 @@ public class XpService : INService, IReadyExecutor, IExecNoCommand } else // channel { - await ch?.SendConfirmAsync(_eb, - _strings.GetText(strs.level_up_channel(user.Mention, - Format.Bold(newLevel.ToString())), - guild.Id)); + if (ch is not null) + { + await ch.SendConfirmAsync(_eb, + _strings.GetText(strs.level_up_channel(user.Mention, + Format.Bold(newLevel.ToString())), + guild.Id)); + } } } else // global level