Skip to content

Commit

Permalink
fix: nil pointer exception
Browse files Browse the repository at this point in the history
When the warcserver resource handler is configured with TiKV and
no results are found the handler panics because it tries to
access methods on `res` (which can be nil).
  • Loading branch information
maeb committed May 16, 2024
1 parent 696146c commit b9ef2f1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions server/warcserver/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ func (h Handler) resource(w http.ResponseWriter, r *http.Request) {
}
break
}
if res == nil {
http.NotFound(w, r)
return

}

ctx, cancel := context.WithTimeout(r.Context(), 10*time.Second)
defer cancel()
Expand Down

0 comments on commit b9ef2f1

Please sign in to comment.