mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-06 15:47:39 +03:00
fix crash
This commit is contained in:
parent
6c2d7c7044
commit
1c1adaf078
@ -1,5 +1,6 @@
|
|||||||
#include "WifiCredentialStore.h"
|
#include "WifiCredentialStore.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <HardwareSerial.h>
|
#include <HardwareSerial.h>
|
||||||
#include <SDCardManager.h>
|
#include <SDCardManager.h>
|
||||||
#include <Serialization.h>
|
#include <Serialization.h>
|
||||||
@ -102,7 +103,7 @@ bool WifiCredentialStore::loadFromFile() {
|
|||||||
|
|
||||||
bool WifiCredentialStore::addCredential(const std::string& ssid, const std::string& password) {
|
bool WifiCredentialStore::addCredential(const std::string& ssid, const std::string& password) {
|
||||||
// Check if this SSID already exists and update it
|
// 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; });
|
[&ssid](const WifiCredential& cred) { return cred.ssid == ssid; });
|
||||||
if (cred != credentials.end()) {
|
if (cred != credentials.end()) {
|
||||||
cred->password = password;
|
cred->password = password;
|
||||||
@ -123,7 +124,7 @@ bool WifiCredentialStore::addCredential(const std::string& ssid, const std::stri
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool WifiCredentialStore::removeCredential(const std::string& ssid) {
|
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; });
|
[&ssid](const WifiCredential& cred) { return cred.ssid == ssid; });
|
||||||
if (cred != credentials.end()) {
|
if (cred != credentials.end()) {
|
||||||
credentials.erase(cred);
|
credentials.erase(cred);
|
||||||
@ -134,7 +135,7 @@ bool WifiCredentialStore::removeCredential(const std::string& ssid) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const WifiCredential* WifiCredentialStore::findCredential(const std::string& ssid) const {
|
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; });
|
[&ssid](const WifiCredential& cred) { return cred.ssid == ssid; });
|
||||||
|
|
||||||
if (cred != credentials.end()) {
|
if (cred != credentials.end()) {
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
#include <GfxRenderer.h>
|
#include <GfxRenderer.h>
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include "MappedInputManager.h"
|
#include "MappedInputManager.h"
|
||||||
@ -362,7 +363,7 @@ void WifiSelectionActivity::loop() {
|
|||||||
WIFI_STORE.removeCredential(selectedSSID);
|
WIFI_STORE.removeCredential(selectedSSID);
|
||||||
xSemaphoreGive(renderingMutex);
|
xSemaphoreGive(renderingMutex);
|
||||||
// Update the network list to reflect the change
|
// 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; });
|
[this](const WifiNetworkInfo& net) { return net.ssid == selectedSSID; });
|
||||||
if (network != networks.end()) {
|
if (network != networks.end()) {
|
||||||
network->hasSavedPassword = false;
|
network->hasSavedPassword = false;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user