From 0192616bc757232c354932d2e62df5aa37c3e9ce Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Mon, 19 Feb 2024 17:22:24 -0800 Subject: Address TODO. --- gfx/src/scene/scene_memory.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gfx/src/scene/scene_memory.c b/gfx/src/scene/scene_memory.c index 3030a8a..85c27e7 100644 --- a/gfx/src/scene/scene_memory.c +++ b/gfx/src/scene/scene_memory.c @@ -125,9 +125,8 @@ void scene_mem_destroy() { /* void mem_free_xyz(xyz**); */ \ void mem_free_##name(type** obj) { mempool_free(&MEM_FIELD(name), obj); } \ /* xyz* mem_get_xyz(xyz_idx); */ \ - /* TODO: Check for 0 index and return nullptr? Otherwise this can \ - * accidentally return a pointer to the dummy objects. */ \ type* mem_get_##name(NAMED_INDEX(name) index) { \ + assert(index.val != 0); /* 0 is the dummy allocation. */ \ return mempool_get_block(&MEM_FIELD(name), index.val); \ } \ /* xyz_idx mem_get_xyz_index(const xyz*); */ \ -- cgit v1.2.3