Skip to content

Commit 7bd42ab

Browse files
committed
conversion: Allow getField to return nil in UnconditionalFieldRestorer
1 parent fdc5f49 commit 7bd42ab

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/utils/conversion/restore.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ func (r unconditionalFieldRestorer[T, F]) marshalState(src, _ T) (json.RawMessag
186186
f := r.getField(src)
187187

188188
// We could do this with a comparable constraint on F, but that's too restrictive for an arbitrary struct.
189-
if reflect.ValueOf(f).Elem().IsZero() {
189+
if f == nil || reflect.ValueOf(f).Elem().IsZero() {
190190
return nil, nil
191191
}
192192

0 commit comments

Comments
 (0)