Don't process nil

This commit is contained in:
Asim Aslam 2019-01-10 22:14:32 +00:00
parent 04103fe048
commit 3043841cf5

View File

@ -19,10 +19,16 @@ func (c *Codec) ReadHeader(m *codec.Message, t codec.MessageType) error {
}
func (c *Codec) ReadBody(b interface{}) error {
if b == nil {
return nil
}
return c.Decoder.Decode(b)
}
func (c *Codec) Write(m *codec.Message, b interface{}) error {
if b == nil {
return nil
}
return c.Encoder.Encode(b)
}