Skip to content

Commit

Permalink
Check that recovery formatter is not nil before calling
Browse files Browse the repository at this point in the history
  • Loading branch information
jszwedko committed May 25, 2020
1 parent 4bd1b67 commit 2810f45
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion recovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,9 @@ func (rec *Recovery) ServeHTTP(rw http.ResponseWriter, r *http.Request, next htt
// If set to false it will respond with the standard response documented here https://httpstat.us/500
if rec.PrintStack {
infos.Stack = stack
rec.Formatter.FormatPanicError(rw, r, infos)
if rec.Formatter != nil {
rec.Formatter.FormatPanicError(rw, r, infos)
}
} else {
if rw.Header().Get("Content-Type") == "" {
rw.Header().Set("Content-Type", "text/plain; charset=utf-8")
Expand Down

0 comments on commit 2810f45

Please sign in to comment.