Skip to content

Commit

Permalink
Handle nil context fields, not just a nil context
Browse files Browse the repository at this point in the history
Found while testing crossplane-contrib/function-patch-and-transform#17

Signed-off-by: Nic Cope <[email protected]>
  • Loading branch information
negz committed Oct 16, 2023
1 parent 26c3c27 commit ffe3c15
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion response/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func To(req *v1beta1.RunFunctionRequest, ttl time.Duration) *v1beta1.RunFunction

// SetContextKey sets context to the supplied key.
func SetContextKey(rsp *v1beta1.RunFunctionResponse, key string, v *structpb.Value) {
if rsp.Context == nil {
if rsp.GetContext().GetFields() == nil {
rsp.Context = &structpb.Struct{Fields: make(map[string]*structpb.Value)}
}
rsp.Context.Fields[key] = v
Expand Down

0 comments on commit ffe3c15

Please sign in to comment.