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:
Marco 2020-02-01 12:52:17 +01:00 committed by Marco98
parent 7180bd0f27
commit 1f5a58d64a

View File

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