mirror of
https://github.com/gogf/gf.git
synced 2025-04-05 11:18:50 +08:00
improve gutil.Dump feature
This commit is contained in:
parent
9e056dfac8
commit
329f6b90f7
@ -87,7 +87,7 @@ func doDump(value interface{}, indent string, buffer *bytes.Buffer, option doDum
|
||||
var reflectValue reflect.Value
|
||||
if v, ok := value.(reflect.Value); ok {
|
||||
reflectValue = v
|
||||
if v.CanInterface() {
|
||||
if v.IsValid() && v.CanInterface() {
|
||||
value = v.Interface()
|
||||
} else {
|
||||
if convertedValue, ok := reflection.ValueToInterface(v); ok {
|
||||
@ -410,7 +410,7 @@ func doDumpBool(in doDumpInternalInput) {
|
||||
|
||||
func doDumpDefault(in doDumpInternalInput) {
|
||||
var s string
|
||||
if in.ReflectValue.CanInterface() {
|
||||
if in.ReflectValue.IsValid() && in.ReflectValue.CanInterface() {
|
||||
s = fmt.Sprintf("%v", in.ReflectValue.Interface())
|
||||
}
|
||||
if s == "" {
|
||||
|
Loading…
x
Reference in New Issue
Block a user