Skip to content

Commit

Permalink
fix(state): fixing panic when err != nil but response is nil (#2339)
Browse files Browse the repository at this point in the history
There was a panic when err != nil but response == nil, for example in
the case of: `rpc error: code = NotFound desc = account
celestia1gchva5av4v798xmqttln9qw9smzrjm2cv2q8e7 not found`

```
2023-06-07T14:20:38.731+0200	ERROR	rpc	go-jsonrpc@v0.3.1/handler.go:276	panic in rpc method 'blob.Submit': runtime error: invalid memory address or nil pointer dereference
```

---------

Co-authored-by: Vlad <13818348+walldiss@users.noreply.github.com>
  • Loading branch information
distractedm1nd and walldiss authored Jun 8, 2023
1 parent b046184 commit f632908
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion state/core_access.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ func (ca *CoreAccessor) SubmitPayForBlob(
ca.payForBlobCount++
}

if response.Code != 0 {
if response != nil && response.Code != 0 {
err = errors.Join(err, sdkErrors.ABCIError(response.Codespace, response.Code, response.Logs.String()))
}
return response, err
Expand Down

0 comments on commit f632908

Please sign in to comment.