Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add gRPC nil/zero check in query #13352

Merged
merged 13 commits into from Sep 29, 2022
4 changes: 4 additions & 0 deletions codec/proto_codec.go
Expand Up @@ -43,6 +43,10 @@ func NewProtoCodec(interfaceRegistry types.InterfaceRegistry) *ProtoCodec {
// NOTE: this function must be used with a concrete type which
// implements proto.Message. For interface please use the codec.MarshalInterface
func (pc *ProtoCodec) Marshal(o ProtoMarshaler) ([]byte, error) {
// check nil messages early on to avoid panic.
if o.Size() == 0 {
alexanderbez marked this conversation as resolved.
Show resolved Hide resolved
return nil, nil
}
return o.Marshal()
}

Expand Down