Sfoglia il codice sorgente

api.Context.NotFound(...) should tolerate nil (#11288) (#11306)

There is an unfortunate signature change with the api.Context
NotFound function; whereas the normal modules/context/Context
NotFound function requires an error or nil, the api.Context
variant will panic with an NPE if a nil is provided.

This PR will allow api.Context.NotFound to tolerate a being
passed a nil.

Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: Lauris BH <lauris@nix.lv>
tags/v1.11.5
zeripath 4 anni fa
parent
commit
91e6a7f7ea
Nessun account collegato all'indirizzo email del committer
1 ha cambiato i file con 5 aggiunte e 0 eliminazioni
  1. 5
    0
      modules/context/api.go

+ 5
- 0
modules/context/api.go Vedi File

var message = "Not Found" var message = "Not Found"
var errors []string var errors []string
for _, obj := range objs { for _, obj := range objs {
// Ignore nil
if obj == nil {
continue
}

if err, ok := obj.(error); ok { if err, ok := obj.(error); ok {
errors = append(errors, err.Error()) errors = append(errors, err.Error())
} else { } else {

Loading…
Annulla
Salva