chain: dont check for null settings value in overwriteRwSetting

- Just call updateRwSetting it will erase the settings when the new
  value is null.
This commit is contained in:
ismaelsadeeq committed 2024-09-11 17:04:28 +01:00
1 parent df601993f2
commit f8d91f49c7
2 files changed
+3 -1

No files matched your search

+3
View File
@@ -363,6 +363,9 @@ public:
virtual bool updateRwSetting(const std::string& name, const SettingsUpdate& update_function) = 0;
//! Replace a setting in <datadir>/settings.json with a new value.
//! Null can be passed to erase the setting.
//! This method provides a simpler alternative to updateRwSetting when
//! atomically reading and updating the setting is not required.
virtual bool overwriteRwSetting(const std::string& name, common::SettingsValue value, SettingsAction action = SettingsAction::WRITE) = 0;
//! Delete a given setting in <datadir>/settings.json.
-1
View File
@@ -834,7 +834,6 @@ public:
}
bool overwriteRwSetting(const std::string& name, common::SettingsValue value, interfaces::SettingsAction action) override
{
if (value.isNull()) return deleteRwSettings(name, action);
return updateRwSetting(name, [&](common::SettingsValue& settings) {
settings = std::move(value);
return action;