From 8f0c5fab471138fd179bc2167e2eb685a0c517ec Mon Sep 17 00:00:00 2001 From: Kwoth Date: Tue, 8 Nov 2022 07:45:46 +0100 Subject: [PATCH] Fixed nullref in cmdcd --- .../Modules/Permissions/CommandCooldown/CmdCdService.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/NadekoBot/Modules/Permissions/CommandCooldown/CmdCdService.cs b/src/NadekoBot/Modules/Permissions/CommandCooldown/CmdCdService.cs index 025a1dcfc..f85306bff 100644 --- a/src/NadekoBot/Modules/Permissions/CommandCooldown/CmdCdService.cs +++ b/src/NadekoBot/Modules/Permissions/CommandCooldown/CmdCdService.cs @@ -29,8 +29,11 @@ public sealed class CmdCdService : IExecPreCommand, IReadyExecutor, INService public Task ExecPreCommandAsync(ICommandContext context, string moduleName, CommandInfo command) => TryBlock(context.Guild, context.User, command.Name.ToLowerInvariant()); - public Task TryBlock(IGuild guild, IUser user, string commandName) + public Task TryBlock(IGuild? guild, IUser user, string commandName) { + if (guild is null) + return Task.FromResult(false); + if (!_settings.TryGetValue(guild.Id, out var cooldownSettings)) return Task.FromResult(false);