fix(serialization): default value lookup

This commit is contained in:
yusing
2025-10-01 20:09:03 +08:00
parent 27f190c3a2
commit c2c22dca0b

View File

@@ -59,7 +59,7 @@ func RegisterDefaultValueFactory[T any](factory func() *T) {
// otherwise, initialize the ptr with zero value.
func initPtr(dst reflect.Value) {
dstT := dst.Type()
if dv, ok := defaultValues[dstT]; ok {
if dv, ok := defaultValues[dstT.Elem()]; ok {
dst.Set(reflect.ValueOf(dv()))
} else {
gi.ReflectInitPtr(dst)