fix issue of nil pointer in package internal/utils

This commit is contained in:
John Guo
2022-04-11 20:43:32 +08:00
parent 190a53647e
commit d0f2928cec

View File

@ -83,10 +83,11 @@ func IsMap(value interface{}) bool {
// IsStruct checks whether `value` is type of struct.
func IsStruct(value interface{}) bool {
var (
reflectType = reflect.TypeOf(value)
reflectKind = reflectType.Kind()
)
var reflectType = reflect.TypeOf(value)
if reflectType == nil {
return false
}
var reflectKind = reflectType.Kind()
for reflectKind == reflect.Ptr {
reflectType = reflectType.Elem()
reflectKind = reflectType.Kind()