diff options
| author | Dave Astels <dastels@daveastels.com> | 2019-08-20 17:00:24 -0400 |
|---|---|---|
| committer | Dave Astels <dastels@daveastels.com> | 2019-08-20 17:00:24 -0400 |
| commit | 56aad056daf1a3377e437d011da4f6cf9a7c82ba (patch) | |
| tree | 4622ed7d6e97a1a57e8fb30830e71277c71567ff | |
| parent | eb0a8cc0bf5ccb93a4ad89e2cf965a45986fec2e (diff) | |
getting the buffer info should happen first (due to its check)
| -rw-r--r-- | shared-bindings/displayio/Display.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/shared-bindings/displayio/Display.c b/shared-bindings/displayio/Display.c index 099035f41..c8cb66f69 100644 --- a/shared-bindings/displayio/Display.c +++ b/shared-bindings/displayio/Display.c @@ -395,6 +395,9 @@ STATIC mp_obj_t displayio_display_obj_fill_row(size_t n_args, const mp_obj_t *po mp_int_t y = args[ARG_y].u_int; mp_obj_array_t *result = args[ARG_buffer].u_obj; + mp_buffer_info_t bufinfo; + mp_get_buffer_raise(result, &bufinfo, MP_BUFFER_WRITE); + if (result->typecode != BYTEARRAY_TYPECODE) { mp_raise_ValueError(translate("Buffer is not a bytearray.")); } @@ -402,9 +405,6 @@ STATIC mp_obj_t displayio_display_obj_fill_row(size_t n_args, const mp_obj_t *po mp_raise_ValueError(translate("Display must have a 16 bit colorspace.")); } - mp_buffer_info_t bufinfo; - mp_get_buffer_raise(result, &bufinfo, MP_BUFFER_WRITE); - displayio_area_t area = { .x1 = 0, .y1 = y, |
