fix: config_save_wifi — always write both credentials
Replace short-circuit boolean evaluation of putString return values with separate size_t variables so both writes always execute regardless of whether the first succeeds. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -25,10 +25,10 @@ bool config_load(DeviceConfig& cfg) {
|
|||||||
bool config_save_wifi(const String& ssid, const String& pass) {
|
bool config_save_wifi(const String& ssid, const String& pass) {
|
||||||
Preferences prefs;
|
Preferences prefs;
|
||||||
prefs.begin(NS, false);
|
prefs.begin(NS, false);
|
||||||
bool ok = prefs.putString("wifi_ssid", ssid) &&
|
size_t r1 = prefs.putString("wifi_ssid", ssid);
|
||||||
prefs.putString("wifi_pass", pass);
|
size_t r2 = prefs.putString("wifi_pass", pass);
|
||||||
prefs.end();
|
prefs.end();
|
||||||
return ok;
|
return (r1 > 0) && (r2 > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool config_has_wifi() {
|
bool config_has_wifi() {
|
||||||
|
|||||||
Reference in New Issue
Block a user