Nil handling added

This commit is contained in:
Matthias Fulz 2020-02-23 03:23:17 +01:00
parent 0d6b55960b
commit ede43deb48
2 changed files with 8 additions and 0 deletions

View File

@ -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")

View File

@ -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")