Merge PR #215: Always initialize device settings params

pull/229/head
Jenkins nymea 2019-10-18 14:57:22 +02:00
commit c066962a66
1 changed files with 7 additions and 0 deletions

View File

@ -1207,6 +1207,13 @@ void DeviceManagerImplementation::loadConfiguredDevices()
}
}
DeviceUtils::verifyParams(deviceClass.settingsTypes(), deviceSettings);
// Make sure all settings are around. if they aren't initialize with default values
foreach (const ParamType &settingsType, deviceClass.settingsTypes()) {
if (!deviceSettings.hasParam(settingsType.id())) {
deviceSettings.append(Param(settingsType.id(), settingsType.defaultValue().isValid() ? settingsType.defaultValue() : ""));
}
}
device->setSettings(deviceSettings);
settings.endGroup(); // Settings