Browse Source

Fixed a nullref when an embed is not provided to SendMessage

tags/1.0-rc
RogueException 8 years ago
parent
commit
cf2596db58
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      src/Discord.Net.Rest/Entities/Channels/ChannelHelper.cs

+ 1
- 1
src/Discord.Net.Rest/Entities/Channels/ChannelHelper.cs View File

@@ -152,7 +152,7 @@ namespace Discord.Rest
public static async Task<RestUserMessage> SendMessageAsync(IMessageChannel channel, BaseDiscordClient client, public static async Task<RestUserMessage> SendMessageAsync(IMessageChannel channel, BaseDiscordClient client,
string text, bool isTTS, Embed embed, RequestOptions options) string text, bool isTTS, Embed embed, RequestOptions options)
{ {
var args = new CreateMessageParams(text) { IsTTS = isTTS, Embed = embed.ToModel() };
var args = new CreateMessageParams(text) { IsTTS = isTTS, Embed = embed?.ToModel() };
var model = await client.ApiClient.CreateMessageAsync(channel.Id, args, options).ConfigureAwait(false); var model = await client.ApiClient.CreateMessageAsync(channel.Id, args, options).ConfigureAwait(false);
return RestUserMessage.Create(client, channel, client.CurrentUser, model); return RestUserMessage.Create(client, channel, client.CurrentUser, model);
} }


Loading…
Cancel
Save