diff --git a/include/ioh/common/factory.hpp b/include/ioh/common/factory.hpp index 73f8e744..941360bd 100644 --- a/include/ioh/common/factory.hpp +++ b/include/ioh/common/factory.hpp @@ -136,6 +136,13 @@ namespace ioh::common const auto already_defined = name_map.find(name) != std::end(name_map); + // Check if the name is empty and ignore it if so + if (name.empty()) { + std::cerr << "Ignoring attempt to include an entry with an empty name." << std::endl; + return; // Exit the function early + } + + std::cerr << "Including in factory:" << std::endl; std::cerr << "Name: " << name << std::endl; std::cerr << "ID: " << id << std::endl;