FIX: erase the access code records while empty

jira: [STUDIO-11102]
Change-Id: Iab43485789f74e635b7de195cbe8683f6b9e9be6
(cherry picked from commit 9441a32ca363aad727cf8c66e2f61953598a15a3)
This commit is contained in:
xin.zhang
2025-04-01 17:51:34 +08:00
committed by Noisyfox
parent 426b5900ee
commit b474eb0613

View File

@@ -543,9 +543,13 @@ void MachineObject::set_access_code(std::string code, bool only_refresh)
this->access_code = code;
if (only_refresh) {
AppConfig* config = GUI::wxGetApp().app_config;
if (config && !code.empty()) {
GUI::wxGetApp().app_config->set_str("access_code", dev_id, code);
DeviceManager::update_local_machine(*this);
if (config) {
if (!code.empty()) {
GUI::wxGetApp().app_config->set_str("access_code", dev_id, code);
DeviceManager::update_local_machine(*this);
} else {
GUI::wxGetApp().app_config->erase("access_code", dev_id);
}
}
}
}