8000 only return NVS error code if it is not OK · hasevr/esp32-snippets@aef10f4 · GitHub
[go: up one dir, main page]

Skip to content

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit aef10f4

Browse files
committed
only return NVS error code if it is not OK
1 parent b1c5399 commit aef10f4

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

cpp_utils/CPPNVS.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,16 @@ int NVS::get(std::string key, std::string* result, bool isBlob) {
7474
size_t length;
7575
if (isBlob) {
7676
esp_err_t rc = ::nvs_get_blob(m_handle, key.c_str(), NULL, &length);
77-
ESP_LOGD(LOG_TAG, "Error getting key: %i", rc);
78-
return rc;
77+
if (rc != ESP_OK) {
78+
ESP_LOGI(LOG_TAG, "Error getting key: %i", rc);
79+
return rc;
80+
}
7981
} else {
8082
esp_err_t rc = ::nvs_get_str(m_handle, key.c_str(), NULL, &length);
81-
ESP_LOGD(LOG_TAG, "Error getting key: %i", rc);
82-
return rc;
83+
if (rc != ESP_OK) {
84+
ESP_LOGI(LOG_TAG, "Error getting key: %i", rc);
85+
return rc;
86+
}
8387
}
8488
char *data = (char *)malloc(length);
8589
if (isBlob) {

0 commit comments

Comments
 (0)
0