mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-11-16 19:56:51 +08:00
Fix: crash when key value is nil
This commit is contained in:
parent
3a065853c4
commit
041702aac6
|
@ -47,11 +47,11 @@ func (d *Decoder) Decode(src map[string]interface{}, dst interface{}) error {
|
|||
}
|
||||
|
||||
value, ok := src[key]
|
||||
if !ok {
|
||||
if !ok || value == nil {
|
||||
if omitempty {
|
||||
continue
|
||||
}
|
||||
return fmt.Errorf("key %s missing", key)
|
||||
return fmt.Errorf("key '%s' missing", key)
|
||||
}
|
||||
|
||||
err := d.decode(key, value, v.Field(idx))
|
||||
|
|
Loading…
Reference in New Issue
Block a user