Skip to content

Commit

Permalink
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.
  • Loading branch information
jholdstock committed Jul 9, 2024
1 parent 7be932d commit 905840b
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 905840b

Please sign in to comment.