[CFG] End preferences when key not found (#1640)
This commit is contained in:
1 parent
b1667190d5
commit
e640c8342a
3 files changed
+13
-1
No files matched your search
@@ -256,6 +256,9 @@ void BTConfig_fromJson(JsonObject& BTdata, bool startup = false) {
|
||||
preferences.end();
|
||||
Log.notice(F("BT config erased" CR));
|
||||
return; // Erase prevails on save, so skipping save
|
||||
} else {
|
||||
preferences.end();
|
||||
Log.notice(F("BT config not found" CR));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -310,6 +313,9 @@ void BTConfig_load() {
|
||||
JsonObject jo = jsonBuffer.as<JsonObject>();
|
||||
BTConfig_fromJson(jo, true); // Never send MQTT message with config
|
||||
Log.notice(F("BT config loaded" CR));
|
||||
} else {
|
||||
preferences.end();
|
||||
Log.notice(F("BT config not found" CR));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user