8000 Improve null handling in API settings PATCH by w3irdrobot · Pull Request #748 · bitaxeorg/ESP-Miner · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Improve null handling in API settings PATCH #748

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions main/http_server/http_server.c
BEE3
Original file line number Diff line number Diff line change
Expand Up @@ -414,22 +414,22 @@ static esp_err_t PATCH_update_settings(httpd_req_t * req)
return ESP_OK;
}

if ((item = cJSON_GetObjectItem(root, "stratumURL")) != NULL) {
if (cJSON_IsString(item = cJSON_GetObjectItem(root, "stratumURL"))) {
nvs_config_set_string(NVS_CONFIG_STRATUM_URL, item->valuestring);
}
if ((item = cJSON_GetObjectItem(root, "fallbackStratumURL")) != NULL) {
if (cJSON_IsString(item = cJSON_GetObjectItem(root, "fallbackStratumURL"))) {
nvs_config_set_string(NVS_CONFIG_FALLBACK_STRATUM_URL, item->valuestring);
}
if ((item = cJSON_GetObjectItem(root, "stratumUser")) != NULL) {
if (cJSON_IsString(item = cJSON_GetObjectItem(root, "stratumUser"))) {
nvs_config_set_string(NVS_CONFIG_STRATUM_USER, item->valuestring);
}
if ((item = cJSON_GetObjectItem(root, "stratumPassword")) != NULL) {
if (cJSON_IsString(item = cJSON_GetObjectItem(root, "stratumPassword"))) {
nvs_config_set_string(NVS_CONFIG_STRATUM_PASS, item->valuestring);
}
if ((item = cJSON_GetObjectItem(root, "fallbackStratumUser")) != NULL) {
if (cJSON_IsString(item = cJSON_GetObjectItem(root, "fallbackStratumUser"))) {
nvs_config_set_string(NVS_CONFIG_FALLBACK_STRATUM_USER, item->valuestring);
}
if ((item = cJSON_GetObjectItem(root, "fallbackStratumPassword")) != NULL) {
if (cJSON_IsString(item = cJSON_GetObjectItem(root, "fallbackStratumPassword"))) {
nvs_config_set_string(NVS_CONFIG_FALLBACK_STRATUM_PASS, item->valuestring);
}
if ((item = cJSON_GetObjectItem(root, "stratumPort")) != NULL) {
Expand All @@ -438,13 +438,13 @@ static esp_err_t PATCH_update_settings(httpd_req_t * req)
if ((item = cJSON_GetObjectItem(root, "fallbackStratumPort")) != NULL) {
nvs_config_set_u16(NVS_CONFIG_FALLBACK_STRATUM_PORT, item->valueint);
}
if ((item = cJSON_GetObjectItem(root, "ssid")) != NULL) {
if (cJSON_IsString(item = cJSON_GetObjectItem(root, "ssid"))) {
nvs_config_set_string(NVS_CONFIG_WIFI_SSID, item->valuestring);
}
if ((item = cJSON_GetObjectItem(root, "wifiPass")) != NULL) {
if (cJSON_IsString(item = cJSON_GetObjectItem(root, "wifiPass"))) {
nvs_config_set_string(NVS_CONFIG_WIFI_PASS, item->valuestring);
}
if ((item = cJSON_GetObjectItem(root, "hostname")) != NULL) {
if (cJSON_IsString(item = cJSON_GetObjectItem(root, "hostname"))) {
nvs_config_set_string(NVS_CONFIG_HOSTNAME, item->valuestring);
}
if ((item = cJSON_GetObjectItem(root, "coreVoltage")) != NULL && item->valueint > 0) {
Expand Down
Loading
0