Browse Source

Dont nullref in SendMessageAsync if no embed is provided

tags/1.0-rc
RogueException 8 years ago
parent
commit
cabbd0de89
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

@@ -112,7 +112,7 @@ namespace Discord.Rest
public static async Task<RestUserMessage> SendMessageAsync(IChannel channel, BaseDiscordClient client, public static async Task<RestUserMessage> SendMessageAsync(IChannel channel, BaseDiscordClient client,
string text, bool isTTS, EmbedBuilder embed, IGuild guild, RequestOptions options) string text, bool isTTS, EmbedBuilder embed, IGuild guild, RequestOptions options)
{ {
var args = new CreateMessageParams(text) { IsTTS = isTTS, Embed = embed.Build() };
var args = new CreateMessageParams(text) { IsTTS = isTTS, Embed = embed?.Build() };
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, guild, model); return RestUserMessage.Create(client, guild, model);
} }


Loading…
Cancel
Save