fix preload on nil pointer
This commit is contained in:
parent
c3bb6aaa82
commit
35d9fc7a31
2
utils.go
2
utils.go
@ -266,6 +266,7 @@ func getValueFromFields(value reflect.Value, fieldNames []string) (results []int
|
|||||||
if indirectValue := reflect.Indirect(value); indirectValue.IsValid() {
|
if indirectValue := reflect.Indirect(value); indirectValue.IsValid() {
|
||||||
for _, fieldName := range fieldNames {
|
for _, fieldName := range fieldNames {
|
||||||
if fieldValue := indirectValue.FieldByName(fieldName); fieldValue.IsValid() {
|
if fieldValue := indirectValue.FieldByName(fieldName); fieldValue.IsValid() {
|
||||||
|
if indirect(fieldValue).IsValid() {
|
||||||
result := fieldValue.Interface()
|
result := fieldValue.Interface()
|
||||||
if r, ok := result.(driver.Valuer); ok {
|
if r, ok := result.(driver.Valuer); ok {
|
||||||
result, _ = r.Value()
|
result, _ = r.Value()
|
||||||
@ -274,6 +275,7 @@ func getValueFromFields(value reflect.Value, fieldNames []string) (results []int
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user