Skip to content

Commit b675c87

Browse files
projectgusdpgeorge
authored andcommitted
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 <[email protected]>
1 parent 1a67d72 commit b675c87

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ports/esp32/machine_sdcard.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ static mp_obj_t machine_sdcard_readblocks(mp_obj_t self_in, mp_obj_t block_num,
364364

365365
err = sdcard_ensure_card_init((sdcard_card_obj_t *)self, false);
366366
if (err != ESP_OK) {
367-
return false;
367+
return mp_const_false;
368368
}
369369

370370
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,
381381

382382
err = sdcard_ensure_card_init((sdcard_card_obj_t *)self, false);
383383
if (err != ESP_OK) {
384-
return false;
384+
return mp_const_false;
385385
}
386386

387387
mp_get_buffer_raise(buf, &bufinfo, MP_BUFFER_READ);

0 commit comments

Comments
 (0)