From c5946498d6a7202f5420ca18561a04e060fa81f1 Mon Sep 17 00:00:00 2001 From: Joe4evr Date: Sun, 16 Oct 2016 22:24:03 +0200 Subject: [PATCH] Prevent NRE --- src/Discord.Net.Commands/CommandContext.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Discord.Net.Commands/CommandContext.cs b/src/Discord.Net.Commands/CommandContext.cs index aa2a99abd..50b41f02e 100644 --- a/src/Discord.Net.Commands/CommandContext.cs +++ b/src/Discord.Net.Commands/CommandContext.cs @@ -21,7 +21,7 @@ public CommandContext(IDiscordClient client, IUserMessage msg) { Client = client; - Guild = (msg.Channel as IGuildChannel).Guild; + Guild = (msg.Channel as IGuildChannel)?.Guild; Channel = msg.Channel; User = msg.Author; Message = msg;