You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: value/reflectcache.go
+5-5
Original file line number
Diff line number
Diff line change
@@ -184,18 +184,18 @@ func (e TypeReflectCacheEntry) ToUnstructured(sv reflect.Value) (interface{}, er
184
184
// This is based on https://github.com/kubernetes/kubernetes/blob/82c9e5c814eb7acc6cc0a090c057294d0667ad66/staging/src/k8s.io/apimachinery/pkg/runtime/converter.go#L505
185
185
// and is intended to replace it.
186
186
187
+
// Check if the object is a nil pointer.
188
+
ifsv.Kind() ==reflect.Ptr&&sv.IsNil() {
189
+
// We're done - we don't need to store anything.
190
+
returnnil, nil
191
+
}
187
192
// Check if the object has a custom string converter and use it if available, since it is much more efficient
188
193
// than round tripping through json.
189
194
ifconverter, ok:=e.getUnstructuredConverter(sv); ok {
190
195
returnconverter.ToUnstructured(), nil
191
196
}
192
197
// Check if the object has a custom JSON marshaller/unmarshaller.
0 commit comments