aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/ComponentManager.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/crepe/ComponentManager.hpp')
-rw-r--r--src/crepe/ComponentManager.hpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/crepe/ComponentManager.hpp b/src/crepe/ComponentManager.hpp
index 828ca8e..66e027f 100644
--- a/src/crepe/ComponentManager.hpp
+++ b/src/crepe/ComponentManager.hpp
@@ -33,7 +33,8 @@ T & ComponentManager::add_component(uint32_t id, Args &&... args) {
T * instance = new T(id, forward<Args>(args)...);
// Check if the vector size is not greater than get_instances_max
- if (components[type][id].size() >= instance->get_instances_max()) {
+ if (instance->get_instances_max() != -1
+ && components[type][id].size() >= instance->get_instances_max()) {
throw std::runtime_error(
"Exceeded maximum number of instances for this component type");
}