graphql: fix nil deref on a timer (#27978)

graphql: fix the panic of nil timer.Stop

Signed-off-by: jsvisa <delweng@gmail.com>
pull/27985/head
Delweng 1 year ago committed by GitHub
parent 16946d218a
commit c31f9cf23a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      graphql/service.go

@ -88,7 +88,9 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
} }
response := h.Schema.Exec(ctx, params.Query, params.OperationName, params.Variables) response := h.Schema.Exec(ctx, params.Query, params.OperationName, params.Variables)
timer.Stop() if timer != nil {
timer.Stop()
}
responded.Do(func() { responded.Do(func() {
responseJSON, err := json.Marshal(response) responseJSON, err := json.Marshal(response)
if err != nil { if err != nil {

Loading…
Cancel
Save