Skip to content

Commit 56aad05

Browse files
committed
getting the buffer info should happen first (due to its check)
1 parent eb0a8cc commit 56aad05

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

shared-bindings/displayio/Display.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -395,16 +395,16 @@ STATIC mp_obj_t displayio_display_obj_fill_row(size_t n_args, const mp_obj_t *po
395395
mp_int_t y = args[ARG_y].u_int;
396396
mp_obj_array_t *result = args[ARG_buffer].u_obj;
397397

398+
mp_buffer_info_t bufinfo;
399+
mp_get_buffer_raise(result, &bufinfo, MP_BUFFER_WRITE);
400+
398401
if (result->typecode != BYTEARRAY_TYPECODE) {
399402
mp_raise_ValueError(translate("Buffer is not a bytearray."));
400403
}
401404
if (self->colorspace.depth != 16) {
402405
mp_raise_ValueError(translate("Display must have a 16 bit colorspace."));
403406
}
404407

405-
mp_buffer_info_t bufinfo;
406-
mp_get_buffer_raise(result, &bufinfo, MP_BUFFER_WRITE);
407-
408408
displayio_area_t area = {
409409
.x1 = 0,
410410
.y1 = y,

0 commit comments

Comments
 (0)