From 52be2b80c15a4a1825234e45b949831fdcff3e76 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Sun, 27 Nov 2022 17:04:25 -0600 Subject: [PATCH] fix out of range Co-authored-by: Mark <56205165+gamblor21@users.noreply.github.com> --- shared-module/_pixelmap/PixelMap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-module/_pixelmap/PixelMap.c b/shared-module/_pixelmap/PixelMap.c index 7599f31f0e..14d07e12fb 100644 --- a/shared-module/_pixelmap/PixelMap.c +++ b/shared-module/_pixelmap/PixelMap.c @@ -165,7 +165,7 @@ void shared_module_pixelmap_pixelmap_setitem(pixelmap_pixelmap_obj_t *self, mp_i } mp_obj_t shared_module_pixelmap_pixelmap_getitem(pixelmap_pixelmap_obj_t *self, mp_int_t i) { - mp_arg_validate_index_range(i, 0, self->len, MP_QSTR_index); + mp_arg_validate_index_range(i, 0, self->len - 1, MP_QSTR_index); mp_obj_t item = self->items[i]; if (mp_obj_is_small_int(item)) { return common_hal_adafruit_pixelbuf_pixelbuf_get_pixel(self->pixelbuf, MP_OBJ_SMALL_INT_VALUE(item));