tolerate missing parts in type_switch key (fix for #562)
This commit is contained in:
@@ -1132,8 +1132,8 @@ void MqttHandler::run() {
|
|||||||
if (!typeSwitchNames.empty()) {
|
if (!typeSwitchNames.empty()) {
|
||||||
vector<string> strs;
|
vector<string> strs;
|
||||||
splitFields(typeSwitch, &strs);
|
splitFields(typeSwitch, &strs);
|
||||||
for (size_t pos = 0; pos < strs.size() && pos < typeSwitchNames.size(); pos++) {
|
for (size_t pos = 0; pos < typeSwitchNames.size(); pos++) {
|
||||||
values.set(typeSwitchNames[pos], strs[pos]);
|
values.set(typeSwitchNames[pos], pos < strs.size() ? strs[pos] : "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user