Browse Source

docs: add note about checking for alloc error

Rickard Andersson 1 year ago
parent
commit
11e884aec5
1 changed files with 2 additions and 0 deletions
  1. 2 0
      core/encoding/json/parser.odin

+ 2 - 0
core/encoding/json/parser.odin

@@ -265,6 +265,8 @@ parse_object_body :: proc(p: ^Parser, end_token: Token_Kind) -> (obj: Object, er
 		}
 		}
 
 
 		insert_success := runtime.map_insert(&obj, key, elem)
 		insert_success := runtime.map_insert(&obj, key, elem)
+		// NOTE(gonz): we'd rather check specifically for an allocation error here but
+		// `map_insert` doesn't differentiate; we can only check for `nil`
 		if insert_success == nil {
 		if insert_success == nil {
 			return nil, .Out_Of_Memory
 			return nil, .Out_Of_Memory
 		}
 		}