Skip to content

Commit

Permalink
marshal_struct_fields: fixed checking the wrong value
Browse files Browse the repository at this point in the history
  • Loading branch information
jkenda committed Feb 19, 2025
1 parent 2ca4241 commit 48e33b0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions core/encoding/json/marshal.odin
Original file line number Diff line number Diff line change
Expand Up @@ -377,17 +377,17 @@ marshal_to_writer :: proc(w: io.Writer, v: any, opt: ^Marshal_Options) -> (err:
}
}

if omitnil && reflect.is_nil(v) {
id := info.types[i].id
data := rawptr(uintptr(v.data) + info.offsets[i])
the_value := any{data, id}

if omitnil && reflect.is_nil(the_value) {
continue
}
if omitempty && reflect.length(v) == 0 {
if omitempty && reflect.length(the_value) == 0 {
continue
}

id := info.types[i].id
data := rawptr(uintptr(v.data) + info.offsets[i])
the_value := any{data, id}

opt_write_iteration(w, opt, first_iteration) or_return
first_iteration = false
if json_name != "" {
Expand Down

0 comments on commit 48e33b0

Please sign in to comment.