Skip to content

Commit

Permalink
fix: crash when poll is null in RestMessageComponent
Browse files Browse the repository at this point in the history
  • Loading branch information
Zaratusa authored Jul 12, 2024
1 parent 6b691b1 commit 6410de2
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 6410de2

Please sign in to comment.