From 11f4dc0d10baa1c421b10fc2f6ffd8d8a7f2ae21 Mon Sep 17 00:00:00 2001 From: Christopher F Date: Sun, 16 Oct 2016 16:25:10 -0400 Subject: [PATCH] Add a missing null-conditional in CommandContext#ctor Prevents an NRE when creating a CommandContext from a message in an IDMChannel --- 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;