From f723bf087901dc37296f480a262158390f17767c Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Thu, 17 Aug 2023 15:50:46 -0700 Subject: [PATCH] ignore nil map values --- api/types.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/api/types.go b/api/types.go index 393555ad..7ed102bf 100644 --- a/api/types.go +++ b/api/types.go @@ -216,6 +216,10 @@ func (opts *Options) FromMap(m map[string]interface{}) error { if opt, ok := jsonOpts[key]; ok { field := valueOpts.FieldByName(opt.Name) if field.IsValid() && field.CanSet() { + if val == nil { + continue + } + switch field.Kind() { case reflect.Int: switch t := val.(type) {