Skip to content

Commit

Permalink
add err check for unmarshal json
Browse files Browse the repository at this point in the history
  • Loading branch information
106umao committed Jul 11, 2022
1 parent ae5eab8 commit 12e2194
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/rm/tcc/tcc_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{})
}
Expand Down

0 comments on commit 12e2194

Please sign in to comment.