mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-04 14:47:37 +03:00
fix crash
This commit is contained in:
parent
6c2d7c7044
commit
1c1adaf078
@ -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()) {
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user