Fix a panic introduced by #1598

- Fixes: #1618

Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
Jonathon Anderson
2024-12-25 13:46:04 -07:00
parent ae47fdfcca
commit 749f1eba1d

View File

@@ -125,6 +125,10 @@ func getNestedFieldValue(obj interface{}, name string) (value reflect.Value, err
}
value = value.Elem()
}
if !value.IsValid() {
err = fmt.Errorf("no value: %v", name)
return
}
value = value.FieldByName(fieldName)
if key != "" {
value = value.MapIndex(reflect.ValueOf(key))