fix crash

This commit is contained in:
Eliz Kilic 2026-02-01 20:33:33 +00:00
parent 6c2d7c7044
commit 1c1adaf078
2 changed files with 6 additions and 4 deletions

View File

@ -1,5 +1,6 @@
#include "WifiCredentialStore.h"
#include <algorithm>
#include <HardwareSerial.h>
#include <SDCardManager.h>
#include <Serialization.h>
@ -102,7 +103,7 @@ bool WifiCredentialStore::loadFromFile() {
bool WifiCredentialStore::addCredential(const std::string& ssid, const std::string& password) {
// Check if this SSID already exists and update it
const auto cred = find_if(credentials.begin(), credentials.end(),
auto cred = std::find_if(credentials.begin(), credentials.end(),
[&ssid](const WifiCredential& cred) { return cred.ssid == ssid; });
if (cred != credentials.end()) {
cred->password = password;
@ -123,7 +124,7 @@ bool WifiCredentialStore::addCredential(const std::string& ssid, const std::stri
}
bool WifiCredentialStore::removeCredential(const std::string& ssid) {
const auto cred = find_if(credentials.begin(), credentials.end(),
auto cred = std::find_if(credentials.begin(), credentials.end(),
[&ssid](const WifiCredential& cred) { return cred.ssid == ssid; });
if (cred != credentials.end()) {
credentials.erase(cred);
@ -134,7 +135,7 @@ bool WifiCredentialStore::removeCredential(const std::string& ssid) {
}
const WifiCredential* WifiCredentialStore::findCredential(const std::string& ssid) const {
const auto cred = find_if(credentials.begin(), credentials.end(),
auto cred = std::find_if(credentials.begin(), credentials.end(),
[&ssid](const WifiCredential& cred) { return cred.ssid == ssid; });
if (cred != credentials.end()) {

View File

@ -3,6 +3,7 @@
#include <GfxRenderer.h>
#include <WiFi.h>
#include <algorithm>
#include <map>
#include "MappedInputManager.h"
@ -362,7 +363,7 @@ void WifiSelectionActivity::loop() {
WIFI_STORE.removeCredential(selectedSSID);
xSemaphoreGive(renderingMutex);
// Update the network list to reflect the change
const auto network = find_if(networks.begin(), networks.end(),
const auto network = std::find_if(networks.begin(), networks.end(),
[this](const WifiNetworkInfo& net) { return net.ssid == selectedSSID; });
if (network != networks.end()) {
network->hasSavedPassword = false;