add nil check
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
979b824b2f
commit
f627fea89e
5
proto.go
5
proto.go
@ -13,6 +13,9 @@ import (
|
||||
type protoCodec struct{}
|
||||
|
||||
func (c *protoCodec) Marshal(v interface{}) ([]byte, error) {
|
||||
if v == nil {
|
||||
return nil, nil
|
||||
}
|
||||
switch m := v.(type) {
|
||||
case *codec.Frame:
|
||||
return m.Data, nil
|
||||
@ -25,7 +28,7 @@ func (c *protoCodec) Marshal(v interface{}) ([]byte, error) {
|
||||
}
|
||||
|
||||
func (c *protoCodec) Unmarshal(d []byte, v interface{}) error {
|
||||
if d == nil {
|
||||
if d == nil || v == nil {
|
||||
return nil
|
||||
}
|
||||
switch m := v.(type) {
|
||||
|
Loading…
Reference in New Issue
Block a user