Skip to content

Commit

Permalink
Fix panic in conversion webhook
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomy2e committed Sep 26, 2022
1 parent c83076e commit 07ba0bc
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/webhook/conversion/conversion.go
Expand Up @@ -69,6 +69,12 @@ func (wh *Webhook) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return
}

if convertReview.Request == nil {
log.Error(nil, "conversion request is nil")
w.WriteHeader(http.StatusBadRequest)
return
}

// TODO(droot): may be move the conversion logic to a separate module to
// decouple it from the http layer ?
resp, err := wh.handleConvertRequest(convertReview.Request)
Expand Down

0 comments on commit 07ba0bc

Please sign in to comment.