Skip to content

Commit

Permalink
Check for nil response (#366)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaitanyaKulkarni28 authored Feb 27, 2024
1 parent ee98248 commit 59ef550
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion metadata/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,11 @@ func (c *Client) retry(ctx context.Context, cfg requestConfig) (string, error) {
fn := func() (string, error) {
resp, err := c.do(ctx, cfg)
if err != nil {
return "", &MDSReqError{resp.StatusCode, err}
statusCode := -1
if resp != nil {
statusCode = resp.StatusCode
}
return "", &MDSReqError{statusCode, err}
}
defer resp.Body.Close()

Expand Down

0 comments on commit 59ef550

Please sign in to comment.