From 3154fcfde4f85cac1d6b4eb5cb596f9e521444d1 Mon Sep 17 00:00:00 2001 From: juzimao <578961953@qq.com> Date: Mon, 11 Jul 2022 22:56:29 +0800 Subject: [PATCH] add err check for unmarshal json --- pkg/rm/tcc/tcc_resource.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/rm/tcc/tcc_resource.go b/pkg/rm/tcc/tcc_resource.go index 215e3f34..8646a888 100644 --- a/pkg/rm/tcc/tcc_resource.go +++ b/pkg/rm/tcc/tcc_resource.go @@ -129,7 +129,9 @@ func (t *TCCResourceManager) getBusinessActionContext(xid string, branchID int64 var actionContextMap = make(map[string]interface{}, 2) if len(applicationData) > 0 { var tccContext map[string]interface{} - json.Unmarshal(applicationData, &tccContext) + if err := json.Unmarshal(applicationData, &tccContext); err != nil { + panic("application data failed to unmarshl as json") + } if v, ok := tccContext[common.ActionContext]; ok { actionContextMap = v.(map[string]interface{}) }