Don't read unless we have b
This commit is contained in:
parent
617db003d4
commit
9ce9977d21
@ -18,13 +18,13 @@ func (c *Codec) ReadHeader(m *codec.Message, t codec.MessageType) error {
|
||||
}
|
||||
|
||||
func (c *Codec) ReadBody(b interface{}) error {
|
||||
if b == nil {
|
||||
return nil
|
||||
}
|
||||
buf, err := ioutil.ReadAll(c.Conn)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if b == nil {
|
||||
return nil
|
||||
}
|
||||
return proto.Unmarshal(buf, b.(proto.Message))
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user