Skip to content

Commit

Permalink
Deepsource: Possible nil pointer dereference GO-W5016
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Ortiz <[email protected]>
  • Loading branch information
taik0 committed Nov 2, 2023
1 parent c33aa8e commit 95b2c72
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mux/jose.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,14 @@ var emptyResponse = []byte("{}")

func jsonRender(w http.ResponseWriter, response *proxy.Response) error {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(response.Metadata.StatusCode)

if response == nil {
_, err := w.Write(emptyResponse)
return err
}

w.WriteHeader(response.Metadata.StatusCode)

js, err := json.Marshal(response.Data)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
Expand Down

0 comments on commit 95b2c72

Please sign in to comment.