From fb2f366812e1027a3f3ee564e54c133db77cb9e1 Mon Sep 17 00:00:00 2001 From: lnd3 Date: Fri, 29 Nov 2024 12:52:11 +0100 Subject: [PATCH] Fix nullptr. --- packages/ecs/include/ecs/entityecs/ECSExt.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/ecs/include/ecs/entityecs/ECSExt.h b/packages/ecs/include/ecs/entityecs/ECSExt.h index 313a561..db9740c 100644 --- a/packages/ecs/include/ecs/entityecs/ECSExt.h +++ b/packages/ecs/include/ecs/entityecs/ECSExt.h @@ -361,7 +361,10 @@ namespace l::ecs { ComponentHandle getFirst() { ComponentViewCache* components = getComponentCache(); Entity* entity = components->getFirst(); - return entity->get(); + if (entity) { + return entity->get(); + } + return ComponentHandle(); } template