Skip to content

Commit

Permalink
rpc_util: handle empty buffer case for copy payInfo.uncompressedBytes
Browse files Browse the repository at this point in the history
  • Loading branch information
hueypark committed Jan 25, 2023
1 parent 493be5d commit ecdb6d2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rpc_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ func recv(p *parser, c baseCodec, s *transport.Stream, dc Decompressor, m interf
if err := c.Unmarshal(buf, m); err != nil {
return status.Errorf(codes.Internal, "grpc: failed to unmarshal the received message: %v", err)
}
if payInfo != nil {
if payInfo != nil && len(buf) != 0 {
payInfo.uncompressedBytes = make([]byte, len(buf))
copy(payInfo.uncompressedBytes, buf)
}
Expand Down

0 comments on commit ecdb6d2

Please sign in to comment.