Skip to content

Commit

Permalink
config: allow NULL as default in config_get_char
Browse files Browse the repository at this point in the history
  • Loading branch information
stintel committed Nov 22, 2023
1 parent dd2815b commit 80816b8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion main/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ char *config_get_char(const char *key, const char *default_value)
if (val != NULL && cJSON_IsString(val) && val->valuestring != NULL) {
ret = strndup(val->valuestring, strlen(val->valuestring));
} else {
ret = strndup(default_value, strlen(default_value));
ret = default_value == NULL ? NULL : strndup(default_value, strlen(default_value));
}
ESP_LOGD(TAG, "config_get_char(%s): %s", key, ret);
return ret;
Expand Down

0 comments on commit 80816b8

Please sign in to comment.