entt::handle invalid{};
if (!invalid.valid()) {
/* do stuff */
}
This leads to the segfault with the following call stack:
#0 0x000000000043e736 in std::vector<entt::entity*, std::allocator<entt::entity*> >::size (this=0xb0) at /usr/local/include/c++/13.2.0/bits/stl_vector.h:990
#1 0x000000000043e9b2 in entt::basic_sparse_set<entt::entity, std::allocator<entt::entity> >::sparse_ptr (this=0xa8, entt=(unknown: 0xffffffff))
at /work/edbr/third_party/entt/src/entt/entity/sparse_set.hpp:168
#2 0x000000000044233d in entt::basic_sparse_set<entt::entity, std::allocator<entt::entity> >::contains (this=0xa8, entt=(unknown: 0xffffffff))
at /work/edbr/third_party/entt/src/entt/entity/sparse_set.hpp:718
#3 0x000000000055b47c in entt::basic_registry<entt::entity, std::allocator<entt::entity> >::valid (this=0x0, entt=(unknown: 0xffffffff))
at /work/edbr/third_party/entt/src/entt/entity/registry.hpp:463
#4 0x0000000000597b60 in entt::basic_handle<entt::basic_registry<entt::entity, std::allocator<entt::entity> >>::valid() const (this=0x7fffffffba60)
at /work/edbr/third_party/entt/src/entt/entity/handle.hpp:173
#5 0x000000000058c7d3 in Game::init (this=0x7fffffffbce0) at /work/edbr/src/Game.cpp:112
I believe valid() call here should either return false or at least assert that the registry is empty instead of segfaulting.
entt version: 3.13.1
Example code:
This leads to the segfault with the following call stack:
I believe
valid()
call here should either returnfalse
or at least assert that the registry is empty instead of segfaulting.