Skip to content

Commit 761869f

Browse files
authored
Merge pull request #433 from damonsmith/master
only return NVS error code if it is not OK
2 parents b1c5399 + aef10f4 commit 761869f

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)