From c7f8bbfbcbbeee945ae84c637ab9554ee5636b50 Mon Sep 17 00:00:00 2001 From: momo <1012651275@qq.com> Date: Tue, 12 Sep 2023 17:49:40 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=E5=90=88=E5=9B=BE,=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/repositories/image_handle.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/service/repositories/image_handle.go b/service/repositories/image_handle.go index b05e1360..753fdc82 100644 --- a/service/repositories/image_handle.go +++ b/service/repositories/image_handle.go @@ -264,7 +264,17 @@ func (l *defaultImageHandle) LogoCombine(ctx context.Context, in *LogoCombineReq logx.Error(err) return nil, err } + if templateInfo["materialList"] == nil { + err = errors.New("materialList is null") + logc.Errorf(ctx, "materialList err:%v", err) + return nil, err + } materialList = templateInfo["materialList"].([]interface{}) + if templateInfo["groupOptions"] == nil { + err = errors.New("groupOptions is null") + logc.Errorf(ctx, "groupOptions err:%v", err) + return nil, err + } groupOptions = templateInfo["groupOptions"].(map[string]interface{}) } From 59598fee13c98ba303b43faf6a0864e4d2a7aa70 Mon Sep 17 00:00:00 2001 From: momo <1012651275@qq.com> Date: Tue, 12 Sep 2023 17:54:31 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=E5=90=88=E5=9B=BE,=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/repositories/image_handle.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/service/repositories/image_handle.go b/service/repositories/image_handle.go index 753fdc82..a18c70de 100644 --- a/service/repositories/image_handle.go +++ b/service/repositories/image_handle.go @@ -264,18 +264,21 @@ func (l *defaultImageHandle) LogoCombine(ctx context.Context, in *LogoCombineReq logx.Error(err) return nil, err } - if templateInfo["materialList"] == nil { + mapMaterialList, existMaterialList := templateInfo["materialList"] + if !existMaterialList { err = errors.New("materialList is null") logc.Errorf(ctx, "materialList err:%v", err) return nil, err } - materialList = templateInfo["materialList"].([]interface{}) - if templateInfo["groupOptions"] == nil { + materialList = mapMaterialList.([]interface{}) + + mapGroupOptions, existGroupOptions := templateInfo["groupOptions"] + if !existGroupOptions { err = errors.New("groupOptions is null") logc.Errorf(ctx, "groupOptions err:%v", err) return nil, err } - groupOptions = templateInfo["groupOptions"].(map[string]interface{}) + groupOptions = mapGroupOptions.(map[string]interface{}) } var moduleDataMap = make(map[string]interface{}, 4)