Browse Source

assert (has) on replace for empty components

Michele Caini 7 years ago
parent
commit
30f71b2ed6
1 changed files with 1 additions and 0 deletions
  1. 1 0
      src/entt/entity/registry.hpp

+ 1 - 0
src/entt/entity/registry.hpp

@@ -121,6 +121,7 @@ class basic_registry {
         template<typename... Args>
         decltype(auto) replace(basic_registry &registry, const Entity entt, Args &&... args) {
             if constexpr(std::is_empty_v<Component>) {
+                assert((storage<Entity, Component>::has(entt)));
                 on_replace.publish(registry, entt, Component{});
                 return Component{std::forward<Args>(args)...};
             } else {