Fixed interface usage

This commit is contained in:
Matthias Fulz 2020-03-25 10:08:25 +01:00
parent ede43deb48
commit 00bcc6c5d2
1 changed files with 2 additions and 2 deletions

View File

@ -552,12 +552,12 @@ func unmarshal(e interface{}, in []byte) (n int, err error) {
var key string
t := reflect.TypeOf(e)
v := reflect.ValueOf(e)
if t.Kind() != reflect.Ptr || v.IsNil() {
if !v.IsValid() || t.Kind() != reflect.Ptr || v.IsNil() {
return 0, errors.New("ssob: Need a pointer that is fully allocated for unmarshalling")
}
p := reflect.Indirect(v)
if p.Kind() != reflect.Ptr {
if p.Kind() != reflect.Ptr && p.Kind() != reflect.Interface {
switch p.Kind() {
case reflect.Bool, reflect.Int8, reflect.Int16, reflect.Int32,
reflect.Int64, reflect.Uint8, reflect.Uint16, reflect.Uint32,