mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
x.json2.decoder2: fix array decoding in struct is field, when array is initialized (#24422)
This commit is contained in:
parent
d9afebc277
commit
a412f53e62
2 changed files with 24 additions and 0 deletions
|
@ -618,6 +618,9 @@ fn (mut decoder Decoder) decode_value[T](mut val T) ! {
|
|||
decoder.decode_map(mut val)!
|
||||
return
|
||||
} $else $if T.unaliased_typ is $array {
|
||||
unsafe {
|
||||
val.len = 0
|
||||
}
|
||||
decoder.decode_array(mut val)!
|
||||
// return to avoid the next increment of the current node
|
||||
// this is because the current node is already incremented in the decode_array function
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue