From 0b6bfea5c89c93d4ec162bed18de88312d55b152 Mon Sep 17 00:00:00 2001 From: Ukendio Date: Sat, 2 Aug 2025 23:57:50 +0200 Subject: [PATCH] Return nil if nth is over count --- jecs.luau | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jecs.luau b/jecs.luau index 73eddc2..32a4baf 100755 --- a/jecs.luau +++ b/jecs.luau @@ -733,7 +733,7 @@ local function world_target(world: world, entity: i53, relation: i53, index: num local nth = index or 0 if nth >= count then - nth = nth + count + 1 + return nil end nth = archetype.types[nth + idr.records[archetype_id]] @@ -2759,7 +2759,7 @@ local function world_new() local nth = index or 0 if nth >= count then - nth = nth + count + 1 + return nil end nth = archetype.types[nth + idr.records[archetype_id]]