Skip to content

Commit b50bb99

Browse files
authored
fix: Check if the response body is nil before panicing (coder#4448)
If a WebSocket connection couldn't be established, a panic would occur.
1 parent daa34cf commit b50bb99

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

codersdk/provisionerdaemons.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ func (c *Client) provisionerJobLogsAfter(ctx context.Context, path string, after
130130
CompressionMode: websocket.CompressionDisabled,
131131
})
132132
if err != nil {
133+
if res == nil {
134+
return nil, nil, err
135+
}
133136
return nil, nil, readBodyAsError(res)
134137
}
135138
logs := make(chan ProvisionerJobLog)

0 commit comments

Comments
 (0)