tolerate missing parts in type_switch key (fix for #562)

This commit is contained in:
John
2022-12-18 09:21:42 +01:00
parent a73c11ecf3
commit 240af58b4c
+2 -2
View File
@@ -1132,8 +1132,8 @@ void MqttHandler::run() {
if (!typeSwitchNames.empty()) {
vector<string> strs;
splitFields(typeSwitch, &strs);
for (size_t pos = 0; pos < strs.size() && pos < typeSwitchNames.size(); pos++) {
values.set(typeSwitchNames[pos], strs[pos]);
for (size_t pos = 0; pos < typeSwitchNames.size(); pos++) {
values.set(typeSwitchNames[pos], pos < strs.size() ? strs[pos] : "");
}
}
}