Don't process nil
This commit is contained in:
parent
04103fe048
commit
3043841cf5
@ -19,10 +19,16 @@ func (c *Codec) ReadHeader(m *codec.Message, t codec.MessageType) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Codec) ReadBody(b interface{}) error {
|
func (c *Codec) ReadBody(b interface{}) error {
|
||||||
|
if b == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
return c.Decoder.Decode(b)
|
return c.Decoder.Decode(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Codec) Write(m *codec.Message, b interface{}) error {
|
func (c *Codec) Write(m *codec.Message, b interface{}) error {
|
||||||
|
if b == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
return c.Encoder.Encode(b)
|
return c.Encoder.Encode(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user