fix(json): return .Out_Of_Memory when out of memory on parse
Previously this would silently simply not do anything and the object would be empty/incomplete when parsed instead.
This commit is contained in:
1 parent
81fe93127d
commit
0a8b266c71
1 file changed
+6
@@ -263,6 +263,12 @@ parse_object_body :: proc(p: ^Parser, end_token: Token_Kind) -> (obj: Object, er
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(obj) == cap(obj) {
|
||||||
|
reserve_error := reserve(&obj, max(1, cap(obj) * 2))
|
||||||
|
if reserve_error != nil {
|
||||||
|
return nil, .Out_Of_Memory
|
||||||
|
}
|
||||||
|
}
|
||||||
obj[key] = elem
|
obj[key] = elem
|
||||||
|
|
||||||
if parse_comma(p) {
|
if parse_comma(p) {
|
||||||
|
|||||||
Reference in new issue
Block a user