Skip to content

Commit 9c5281c

Browse files
committed
sparse_set: make ::pop_all check pages before filling them
1 parent 136b137 commit 9c5281c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/entt/entity/sparse_set.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,10 @@ class basic_sparse_set {
297297
if(!packed.empty()) {
298298
// suboptimal with few entities, but exploits cache way more with many
299299
for(auto &&elem: sparse) {
300-
for(size_type pos{}; pos < traits_type::page_size; ++pos) {
301-
elem[pos] = null;
300+
if(elem) {
301+
for(size_type pos{}; pos < traits_type::page_size; ++pos) {
302+
elem[pos] = null;
303+
}
302304
}
303305
}
304306
}

0 commit comments

Comments
 (0)