Avoid awaiting possible null

This commit is contained in:
Kwoth
2022-07-18 04:45:05 +02:00
parent b12e97a0a7
commit 8eca8e1dfb

View File

@@ -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