This commit is contained in:
John Guo 2023-04-12 10:14:14 +08:00 committed by GitHub
parent 66d0663dc5
commit d788b7ff5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -108,13 +108,13 @@ func doDump(value interface{}, indent string, buffer *bytes.Buffer, option doDum
} else {
reflectValue = reflect.ValueOf(value)
}
var reflectKind = reflectValue.Kind()
// Double check nil value.
if value == nil {
if value == nil || reflectKind == reflect.Invalid {
buffer.WriteString(`<nil>`)
return
}
var (
reflectKind = reflectValue.Kind()
reflectTypeName = reflectValue.Type().String()
ptrAddress string
newIndent = indent + dumpIndent