Skip to content

Commit 3e3e78d

Browse files
committed
rfq: fix potential nil pointer panic
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.
1 parent 093860e commit 3e3e78d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

rfq/negotiator.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,9 @@ func (n *Negotiator) HandleOutgoingBuyOrder(buyOrder BuyOrder) error {
194194
"request: %v", err)
195195
}
196196

197-
assetRateHint = fn.Some[rfqmsg.AssetRate](*assetRate)
197+
assetRateHint = fn.MaybeSome[rfqmsg.AssetRate](
198+
assetRate,
199+
)
198200
}
199201

200202
// Construct a new buy request to send to the peer.

0 commit comments

Comments
 (0)