mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-14 15:11:25 -07:00
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:
@@ -263,6 +263,12 @@ parse_object_body :: proc(p: ^Parser, end_token: Token_Kind) -> (obj: Object, er
|
||||
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
|
||||
|
||||
if parse_comma(p) {
|
||||
|
||||
Reference in New Issue
Block a user