Skip to content

Commit

Permalink
[release-v2.0] vsp: Prevent nil pointer dereference.
Browse files Browse the repository at this point in the history
Previously was checking if fp == nil and then attempting to access fp.

Backport of 905840b.
  • Loading branch information
jholdstock authored and jrick committed Aug 28, 2024
1 parent dcde897 commit 2c7e4dc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions vsp/vsp.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ func (c *Client) Process(ctx context.Context, ticket *wallet.VSPTicket, feeTx *w
// transaction, submit it then confirm.
fp := c.feePayment(ctx, ticket, false)
if fp == nil {
err := fp.ticket.UpdateFeeErrored(ctx, c.Client.URL, c.Client.PubKey)
err := ticket.UpdateFeeErrored(ctx, c.Client.URL, c.Client.PubKey)
if err != nil {
return err
}
Expand All @@ -232,7 +232,7 @@ func (c *Client) Process(ctx context.Context, ticket *wallet.VSPTicket, feeTx *w
fp.mu.Unlock()
err := fp.receiveFeeAddress()
if err != nil {
err := fp.ticket.UpdateFeeErrored(ctx, c.Client.URL, c.Client.PubKey)
err := ticket.UpdateFeeErrored(ctx, c.Client.URL, c.Client.PubKey)
if err != nil {
return err
}
Expand All @@ -243,7 +243,7 @@ func (c *Client) Process(ctx context.Context, ticket *wallet.VSPTicket, feeTx *w
}
err = fp.makeFeeTx(feeTx)
if err != nil {
err := fp.ticket.UpdateFeeErrored(ctx, c.Client.URL, c.Client.PubKey)
err := ticket.UpdateFeeErrored(ctx, c.Client.URL, c.Client.PubKey)
if err != nil {
return err
}
Expand Down

0 comments on commit 2c7e4dc

Please sign in to comment.