From 1f5a58d64aa5cf614140fa8a9bde49b445a84c29 Mon Sep 17 00:00:00 2001 From: Marco <24938492+Marco98@users.noreply.github.com> Date: Sat, 1 Feb 2020 12:52:17 +0100 Subject: [PATCH] check if field is nil to prevent panic check if field is nil to prevent panic when using slice pointers --- callback_query_preload.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/callback_query_preload.go b/callback_query_preload.go index a936180a..f977f84a 100644 --- a/callback_query_preload.go +++ b/callback_query_preload.go @@ -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 }