Skip to content

Commit

Permalink
10
Browse files Browse the repository at this point in the history
Change-Id: I49f14328841cc2e950e244f4cd98c4dcea1f0987
  • Loading branch information
callthingsoff committed Oct 1, 2024
1 parent 0b672df commit 57030f2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/encoding/json/encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,9 @@ func typeFields(t reflect.Type) structFields {
field.isZero = func(v reflect.Value) bool {
// Avoid panics calling IsZero on a nil interface or
// non-nil interface with nil pointer.
return v.IsNil() || (v.Elem().Kind() == reflect.Pointer && v.Elem().IsNil()) || v.Interface().(isZeroer).IsZero()
return v.IsNil() ||
(v.Elem().Kind() == reflect.Pointer && v.Elem().IsNil()) ||
v.Interface().(isZeroer).IsZero()
}
case t.Kind() == reflect.Pointer && t.Implements(isZeroerType):
field.isZero = func(v reflect.Value) bool {
Expand Down

0 comments on commit 57030f2

Please sign in to comment.