aboutsummaryrefslogtreecommitdiff
path: root/core/runtime
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2022-11-10 12:01:40 +0000
committergingerBill <bill@gingerbill.org>2022-11-10 12:01:40 +0000
commit5c106abe3fd1850c3880fcd6753e3e2273c1eded (patch)
tree87e5bbe6b3c382728f259851f6d0d27d9fc81de0 /core/runtime
parentdb748b7a0570d0d98b73033cced4aa8adac56a6b (diff)
Make `map_alloc_dynamic` handle the `nil_allocator()`
Diffstat (limited to 'core/runtime')
-rw-r--r--core/runtime/dynamic_map_internal.odin4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/runtime/dynamic_map_internal.odin b/core/runtime/dynamic_map_internal.odin
index 7f1ea5e68..4a246fd18 100644
--- a/core/runtime/dynamic_map_internal.odin
+++ b/core/runtime/dynamic_map_internal.odin
@@ -334,6 +334,10 @@ map_alloc_dynamic :: proc "odin" (info: ^Map_Info, log2_capacity: uintptr, alloc
data := mem_alloc_non_zeroed(int(size), MAP_CACHE_LINE_SIZE, allocator, loc) or_return
data_ptr := uintptr(raw_data(data))
+ if data_ptr == 0 {
+ err = .Out_Of_Memory
+ return
+ }
if intrinsics.expect(data_ptr & CACHE_MASK != 0, false) {
panic("allocation not aligned to a cache line", loc)
} else {