control: Handle empty profiles for configuration objects
An empty list of profiles for a configuration object should result in
the object being created. The std::any_of function returns false if the
range is empty which would have resulted in the object not being
created where we want it created when there's no profiles defined
restricting the object's usage in fan control.
Change-Id: I4800002294334241e090a0efefc5f71bec752198
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/control/json/manager.hpp b/control/json/manager.hpp
index 2d75977..8ac48d1 100644
--- a/control/json/manager.hpp
+++ b/control/json/manager.hpp
@@ -144,7 +144,8 @@
}
// Do not create the object if its profiles are not in the
// list of active profiles
- if (!std::any_of(profiles.begin(), profiles.end(),
+ if (!profiles.empty() &&
+ !std::any_of(profiles.begin(), profiles.end(),
[](const auto& name) {
return std::find(
getActiveProfiles().begin(),