Browse Source

Add a missing null-conditional in CommandContext#ctor

Prevents an NRE when creating a CommandContext from a message in an IDMChannel
tags/1.0-rc
Christopher F 8 years ago
parent
commit
11f4dc0d10
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      src/Discord.Net.Commands/CommandContext.cs

+ 1
- 1
src/Discord.Net.Commands/CommandContext.cs View File

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


Loading…
Cancel
Save