Skip to content

Commit

Permalink
fix: crash when poll is null in RestMessageComponent (#2958)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zaratusa committed Jul 20, 2024
1 parent f5fdfb2 commit 24c7605
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ public override Task<RestFollowupMessage> FollowupAsync(
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)
Expand Down Expand Up @@ -409,7 +409,7 @@ public override Task<RestFollowupMessage> FollowupWithFilesAsync(
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);
}
Expand Down

0 comments on commit 24c7605

Please sign in to comment.