Skip to content

Commit

Permalink
Fixed the overlooked condition checking of the position of a card button
Browse files Browse the repository at this point in the history
  • Loading branch information
gehongyan committed Aug 31, 2023
1 parent 0369d81 commit 5e1c797
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -369,12 +369,12 @@ public SectionModuleBuilder WithMode(SectionAccessoryMode mode)
/// A <see cref="SectionModule"/> representing the built section module object.
/// </returns>
/// <exception cref="InvalidOperationException">
/// The <see cref="ButtonElement"/> was positioned to the left of the <see cref="Text"/>,
/// The <see cref="ButtonElement"/> was not positioned to the right of the <see cref="Text"/>,
/// which is not allowed.
/// </exception>
public SectionModule Build()
{
if (Mode == SectionAccessoryMode.Left && Accessory is ButtonElementBuilder)
if (Mode != SectionAccessoryMode.Right && Accessory is ButtonElementBuilder)
throw new InvalidOperationException("Button must be placed on the right");

return new SectionModule(Mode, Text?.Build(), Accessory?.Build());
Expand Down

0 comments on commit 5e1c797

Please sign in to comment.