mirror of
https://github.com/fiatjaf/khatru.git
synced 2026-06-03 09:12:59 +02:00
Fix nil check
This commit is contained in:
3
nip86.go
3
nip86.go
@@ -125,12 +125,13 @@ func (rl *Relay) HandleNIP86(w http.ResponseWriter, r *http.Request) {
|
||||
methods := make([]string, 0, mat.NumField())
|
||||
for i := 0; i < mat.NumField(); i++ {
|
||||
field := mat.Field(i)
|
||||
value := mav.Field(i).Interface()
|
||||
|
||||
// danger: this assumes the struct fields are appropriately named
|
||||
methodName := strings.ToLower(field.Name)
|
||||
|
||||
// assign this only if the function was defined
|
||||
if mav.Field(i).Interface() != nil {
|
||||
if !reflect.ValueOf(value).IsNil() {
|
||||
methods = append(methods, methodName)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user