fix: Check if the response body is nil before panicing (#4448)

If a WebSocket connection couldn't be established, a panic would occur.
This commit is contained in:
Kyle Carberry
2022-10-10 18:45:03 +00:00
committed by GitHub
parent daa34cf7b8
commit b50bb99fe7
+3
View File
@@ -130,6 +130,9 @@ func (c *Client) provisionerJobLogsAfter(ctx context.Context, path string, after
CompressionMode: websocket.CompressionDisabled,
})
if err != nil {
if res == nil {
return nil, nil, err
}
return nil, nil, readBodyAsError(res)
}
logs := make(chan ProvisionerJobLog)