Skip to content

Commit

Permalink
fix issue thanos-io#4777: panic when warn is nil
Browse files Browse the repository at this point in the history
Signed-off-by: ian woolf <[email protected]>
  • Loading branch information
ianwoolf committed Oct 15, 2021
1 parent fa476b5 commit b7efa3e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,9 @@ func Respond(w http.ResponseWriter, data interface{}, warnings []error) {
Data: data,
}
for _, warn := range warnings {
if warn == nil {
continue
}
resp.Warnings = append(resp.Warnings, warn.Error())
}
_ = json.NewEncoder(w).Encode(resp)
Expand Down

0 comments on commit b7efa3e

Please sign in to comment.