fix: crash when poll is null in RestMessageComponent (#2958)

This commit is contained in:
Zaratusa
2024-07-20 22:36:06 +02:00
committed by GitHub
parent f5fdfb259b
commit 24c760586b

View File

@@ -278,7 +278,7 @@ namespace Discord.Rest
Embeds = embeds.Select(x => x.ToModel()).ToArray(),
Components = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified,
Flags = ephemeral ? MessageFlags.Ephemeral : MessageFlags.None,
Poll = poll.ToModel() ?? Optional<CreatePollParams>.Unspecified
Poll = poll?.ToModel() ?? Optional<CreatePollParams>.Unspecified
};
if (ephemeral)
@@ -409,7 +409,7 @@ namespace Discord.Rest
Embeds = embeds.Any() ? embeds.Select(x => x.ToModel()).ToArray() : Optional<API.Embed[]>.Unspecified,
AllowedMentions = allowedMentions?.ToModel() ?? Optional<API.AllowedMentions>.Unspecified,
MessageComponents = components?.Components.Select(x => new API.ActionRowComponent(x)).ToArray() ?? Optional<API.ActionRowComponent[]>.Unspecified,
Poll = poll.ToModel() ?? Optional<CreatePollParams>.Unspecified
Poll = poll?.ToModel() ?? Optional<CreatePollParams>.Unspecified
};
return InteractionHelper.SendFollowupAsync(Discord, args, Token, Channel, options);
}