Fix nil check

This commit is contained in:
Jon Staab
2025-06-10 11:05:08 -07:00
committed by fiatjaf_
parent aa81e17e22
commit 932825080e

View File

@@ -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)
}
}