mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
bugfix(nvs_flash): fixed wrong error check after open_nvs_handle
Closes https://github.com/espressif/esp-idf/issues/10240
This commit is contained in:
parent
f58f8116de
commit
1a98df0c93
@ -224,7 +224,7 @@ protected:
|
||||
* - ESP_ERR_NVS_INVALID_NAME if namespace name doesn't satisfy constraints
|
||||
* - other error codes from the underlying storage driver
|
||||
*
|
||||
* @return shared pointer of an nvs handle on success, an empty shared pointer otherwise
|
||||
* @return unique pointer of an nvs handle on success, an empty unique pointer otherwise
|
||||
*/
|
||||
std::unique_ptr<NVSHandle> open_nvs_handle_from_partition(const char *partition_name,
|
||||
const char *ns_name,
|
||||
|
@ -32,9 +32,8 @@ extern "C" void app_main(void)
|
||||
// Open
|
||||
printf("\n");
|
||||
printf("Opening Non-Volatile Storage (NVS) handle... ");
|
||||
esp_err_t result;
|
||||
// Handle will automatically close when going out of scope or when it's reset.
|
||||
std::shared_ptr<nvs::NVSHandle> handle = nvs::open_nvs_handle("storage", NVS_READWRITE, &result);
|
||||
std::unique_ptr<nvs::NVSHandle> handle = nvs::open_nvs_handle("storage", NVS_READWRITE, &err);
|
||||
if (err != ESP_OK) {
|
||||
printf("Error (%s) opening NVS handle!\n", esp_err_to_name(err));
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user