Only check for nil on pointer values on non package types

This commit is contained in:
mariusor 2022-05-25 14:46:36 +02:00
parent 7414b7fad2
commit 1c63584463
No known key found for this signature in database
GPG key ID: DBF5E47F5DBC4D21

View file

@ -145,7 +145,8 @@ func IsNil(it Item) bool {
} else {
// NOTE(marius): we're not dealing with a type that we know about, so we use slow reflection
// as we still care about the result
isNil = reflect.ValueOf(it).IsNil()
v := reflect.ValueOf(it)
isNil = v.Kind() != reflect.Pointer || v.IsNil()
}
return isNil
}