Skip to content

Commit e0e41c7

Browse files
committed
go: Do a nil check before debugging the response
This fixes a nil ptr deref
1 parent 2a3beb9 commit e0e41c7

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

go/svix_http_client.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,13 @@ func executeRequestWithRetries(client *SvixHttpClient, request *http.Request) (*
122122
}
123123

124124
if client.Debug {
125-
dump, err := httputil.DumpResponse(resp, true)
126-
if err != nil {
127-
return resp, err
125+
if resp != nil {
126+
dump, err := httputil.DumpResponse(resp, true)
127+
if err != nil {
128+
return resp, err
129+
}
130+
log.Printf("\n%s\n", string(dump))
128131
}
129-
log.Printf("\n%s\n", string(dump))
130132
}
131133
return resp, err
132134
}

0 commit comments

Comments
 (0)