diff --git a/marshal.go b/marshal.go index 38d7a46..5738615 100644 --- a/marshal.go +++ b/marshal.go @@ -169,6 +169,10 @@ func init() { func encRegister(e interface{}) (err error) { t := reflect.TypeOf(e) + if t == nil { + return errors.New("ssob: Invalid type") + } + switch t.Kind() { case reflect.Invalid: return errors.New("ssob: Invalid type") diff --git a/unmarshal.go b/unmarshal.go index 7737cfd..dc44635 100644 --- a/unmarshal.go +++ b/unmarshal.go @@ -203,6 +203,10 @@ func init() { func decRegister(e interface{}) (err error) { t := reflect.TypeOf(e) + if t == nil { + return errors.New("ssob: Invalid type") + } + switch t.Kind() { case reflect.Invalid: return errors.New("ssob: Invalid type")