Skip to content

Commit

Permalink
Fix nullptr.
Browse files Browse the repository at this point in the history
  • Loading branch information
linuscu committed Nov 29, 2024
1 parent b314b05 commit fb2f366
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/ecs/include/ecs/entityecs/ECSExt.h
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,10 @@ namespace l::ecs {
ComponentHandle<T> getFirst() {
ComponentViewCache<T>* components = getComponentCache<T>();
Entity* entity = components->getFirst();
return entity->get<T>();
if (entity) {
return entity->get<T>();
}
return ComponentHandle<T>();
}

template<typename... Types>
Expand Down

0 comments on commit fb2f366

Please sign in to comment.