esp32/machine_sdcard: Fix invalid result of SDCard.read/writeblocks.
Functions would return NULL instead of `mp_const_false` if failed to init. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
This commit is contained in:
parent
1a67d720c7
commit
b675c87992
1 changed files with 2 additions and 2 deletions
|
|
@ -364,7 +364,7 @@ static mp_obj_t machine_sdcard_readblocks(mp_obj_t self_in, mp_obj_t block_num,
|
||||||
|
|
||||||
err = sdcard_ensure_card_init((sdcard_card_obj_t *)self, false);
|
err = sdcard_ensure_card_init((sdcard_card_obj_t *)self, false);
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
return false;
|
return mp_const_false;
|
||||||
}
|
}
|
||||||
|
|
||||||
mp_get_buffer_raise(buf, &bufinfo, MP_BUFFER_WRITE);
|
mp_get_buffer_raise(buf, &bufinfo, MP_BUFFER_WRITE);
|
||||||
|
|
@ -381,7 +381,7 @@ static mp_obj_t machine_sdcard_writeblocks(mp_obj_t self_in, mp_obj_t block_num,
|
||||||
|
|
||||||
err = sdcard_ensure_card_init((sdcard_card_obj_t *)self, false);
|
err = sdcard_ensure_card_init((sdcard_card_obj_t *)self, false);
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
return false;
|
return mp_const_false;
|
||||||
}
|
}
|
||||||
|
|
||||||
mp_get_buffer_raise(buf, &bufinfo, MP_BUFFER_READ);
|
mp_get_buffer_raise(buf, &bufinfo, MP_BUFFER_READ);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue