Skip to content

Commit

Permalink
rfq: fix potential nil pointer panic
Browse files Browse the repository at this point in the history
Because we don't return if the error returned from the price oracle is
non-nil, the asset rate might be nil in case we couldn't talk to the
oracle. So we need to use fn.MaybeSome() instead of fn.Some() with a
dereference.
  • Loading branch information
guggero committed Dec 3, 2024
1 parent 093860e commit 3e3e78d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion rfq/negotiator.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,9 @@ func (n *Negotiator) HandleOutgoingBuyOrder(buyOrder BuyOrder) error {
"request: %v", err)
}

assetRateHint = fn.Some[rfqmsg.AssetRate](*assetRate)
assetRateHint = fn.MaybeSome[rfqmsg.AssetRate](
assetRate,
)
}

// Construct a new buy request to send to the peer.
Expand Down

0 comments on commit 3e3e78d

Please sign in to comment.