diff options
| author | gingerBill <bill@gingerbill.org> | 2024-03-06 14:51:56 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2024-03-06 14:51:56 +0000 |
| commit | 8d496dc3d018f9cb908134ab7c5ed7edea6e7318 (patch) | |
| tree | 6f14ff7c05deaa769226822442e28aaf659bad1f /core/encoding/json | |
| parent | 04bfc926eedbdee2276748365056e8fa44be8184 (diff) | |
Fix #3173
Diffstat (limited to 'core/encoding/json')
| -rw-r--r-- | core/encoding/json/marshal.odin | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/core/encoding/json/marshal.odin b/core/encoding/json/marshal.odin index 6596621e8..775f78748 100644 --- a/core/encoding/json/marshal.odin +++ b/core/encoding/json/marshal.odin @@ -382,6 +382,11 @@ marshal_to_writer :: proc(w: io.Writer, v: any, opt: ^Marshal_Options) -> (err: opt_write_end(w, opt, '}') or_return case runtime.Type_Info_Union: + if len(info.variants) == 0 || v.data == nil { + io.write_string(w, "null") or_return + return nil + } + tag_ptr := uintptr(v.data) + info.tag_offset tag_any := any{rawptr(tag_ptr), info.tag_type.id} |