Skip to content

Commit

Permalink
Add conditional check for split
Browse files Browse the repository at this point in the history
  • Loading branch information
zbud-msft committed Nov 3, 2022
1 parent dd15a19 commit 43438e2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sonic_data_client/db_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,10 @@ func tableData2Msi(tblPath *tablePath, useKey bool, op *string, msi *map[string]
var key string
// Split dbkey string into two parts and second part is key in table
keys := strings.SplitN(dbkey, tblPath.delimitor, 2)
if len(keys) < 2 {
log.V(3).Infof("dbkey: %s, failed split from delimitor %v", dbkey, tblPath.delimitor)
return fmt.Errorf("dbkey: %s, failed split from delimitor %v", dbkey, tblPath.delimitor)
}
key = keys[1]
err = makeJSON_redis(msi, &key, op, fv)
}
Expand Down

0 comments on commit 43438e2

Please sign in to comment.