control: set_parameter_from_group: handle no max
Handle the case where no members of the group have a value (i.e. they
aren't on D-Bus). In that case, remove that parameter from the
manager.
Change-Id: Idc70d637b1031288fa9bf3a8f23cd7fca09ae8fb
diff --git a/control/json/actions/set_parameter_from_group_max.cpp b/control/json/actions/set_parameter_from_group_max.cpp
index 622c20c..42b5c3c 100644
--- a/control/json/actions/set_parameter_from_group_max.cpp
+++ b/control/json/actions/set_parameter_from_group_max.cpp
@@ -96,7 +96,7 @@
}
}
- if (_modifier)
+ if (_modifier && max)
{
try
{
@@ -112,7 +112,14 @@
}
}
- Manager::setParameter(_name, *max);
+ if (max)
+ {
+ Manager::setParameter(_name, *max);
+ }
+ else
+ {
+ Manager::deleteParameter(_name);
+ }
}
void SetParameterFromGroupMax::setParameterName(const json& jsonObj)