mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2025-01-04 00:23:43 +08:00
chore: structure support decode pointer
This commit is contained in:
parent
e6dad8ef3e
commit
58583c11c9
@ -96,6 +96,11 @@ func (d *Decoder) decode(name string, data any, val reflect.Value) error {
|
|||||||
return d.decodeFloat(name, data, val)
|
return d.decodeFloat(name, data, val)
|
||||||
}
|
}
|
||||||
switch kind {
|
switch kind {
|
||||||
|
case reflect.Pointer:
|
||||||
|
if val.IsNil() {
|
||||||
|
val.Set(reflect.New(val.Type().Elem()))
|
||||||
|
}
|
||||||
|
return d.decode(name, data, val.Elem())
|
||||||
case reflect.String:
|
case reflect.String:
|
||||||
return d.decodeString(name, data, val)
|
return d.decodeString(name, data, val)
|
||||||
case reflect.Bool:
|
case reflect.Bool:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user