check if field is nil to prevent panic
check if field is nil to prevent panic when using slice pointers
This commit is contained in:
parent
7180bd0f27
commit
1f5a58d64a
@ -394,8 +394,8 @@ func (scope *Scope) handleManyToManyPreload(field *Field, conditions []interface
|
||||
|
||||
for source, fields := range fieldsSourceMap {
|
||||
for _, f := range fields {
|
||||
//If not 0 this means Value is a pointer and we already added preloaded models to it
|
||||
if f.Len() != 0 {
|
||||
//If kind is Ptr this means Value is a pointer and we already added preloaded models to it
|
||||
if f.Kind() == reflect.Ptr {
|
||||
continue
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user