Skip to content

Commit

Permalink
Fix panic
Browse files Browse the repository at this point in the history
  • Loading branch information
ammario committed Jan 5, 2024
1 parent 7a3d972 commit 130bd86
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions portfolio.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,14 @@ type CreateOrderRequest struct {

// SetPrice sets the price of the order based on its side.
func (c *CreateOrderRequest) SetPrice(p Cents) {
if c.Side == Yes {
switch c.Side {
case Yes:
c.YesPrice = p
} else if c.Side == No {
case No:
c.NoPrice = p
default:
panic("invalid side: " + string(c.Side))
}

panic("invalid side: " + string(c.Side))
}

// String returns a human-readable representation of the order.
Expand Down

0 comments on commit 130bd86

Please sign in to comment.