diff options
| author | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2022-04-19 20:32:22 +0200 |
|---|---|---|
| committer | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2022-04-19 20:32:22 +0200 |
| commit | a30b9b17b3a91bc856a037c1e1025e389a8524b3 (patch) | |
| tree | ee52c88b5faa406e61ae0a3c5c193fb62412cb35 /core/encoding | |
| parent | 29b2c0476698d0f4b240e87945cfa278da82b57a (diff) | |
[json/unmarshal] Fix quoted strings.
Diffstat (limited to 'core/encoding')
| -rw-r--r-- | core/encoding/json/parser.odin | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/core/encoding/json/parser.odin b/core/encoding/json/parser.odin index c682ec9bd..7bf88c565 100644 --- a/core/encoding/json/parser.odin +++ b/core/encoding/json/parser.odin @@ -354,6 +354,12 @@ unquote_string :: proc(token: Token, spec: Specification, allocator := context.a b := bytes_make(len(s) + 2*utf8.UTF_MAX, 1, allocator) or_return w := copy(b, s[0:i]) + + if len(b) == 0 && allocator.data == nil { + // `unmarshal_count_array` calls us with a nil allocator + return string(b[:w]), nil + } + loop: for i < len(s) { c := s[i] switch { |