Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: panic when the response is nil #23

Merged
merged 1 commit into from Mar 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions rpcclient/infrastructure.go
Expand Up @@ -809,6 +809,16 @@ func (c *Client) handleSendPostMessage(jReq *jsonRequest) {
jReq.responseChan <- &Response{err: err}
return
}
// We still want to return an error if for any reason the respone
// remains empty.
if httpResponse == nil {
jReq.responseChan <- &Response{
err: fmt.Errorf("invalid http POST response (nil), "+
"method: %s, id: %d, last error=%v",
jReq.method, jReq.id, lastErr),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this diff did not cherry-pick cleanly. Some prerequisite commits were not included:
btcsuite#1856 and btcsuite#1862 both preceeded this

}
return
}

// Read the raw bytes and close the response.
respBytes, err := ioutil.ReadAll(httpResponse.Body)
Expand Down