Ver Fonte

sparse_set: make ::pop_all check pages before filling them

skypjack há 2 meses atrás
pai
commit
9c5281c79a
1 ficheiros alterados com 4 adições e 2 exclusões
  1. 4 2
      src/entt/entity/sparse_set.hpp

+ 4 - 2
src/entt/entity/sparse_set.hpp

@@ -297,8 +297,10 @@ protected:
         if(!packed.empty()) {
             // suboptimal with few entities, but exploits cache way more with many
             for(auto &&elem: sparse) {
-                for(size_type pos{}; pos < traits_type::page_size; ++pos) {
-                    elem[pos] = null;
+                if(elem) {
+                    for(size_type pos{}; pos < traits_type::page_size; ++pos) {
+                        elem[pos] = null;
+                    }
                 }
             }
         }