diff --git a/shared-module/_pixelmap/PixelMap.c b/shared-module/_pixelmap/PixelMap.c index d20a6dd03c..7599f31f0e 100644 --- a/shared-module/_pixelmap/PixelMap.c +++ b/shared-module/_pixelmap/PixelMap.c @@ -34,7 +34,7 @@ static void pixelmap_set_pixel_rgbw(pixelmap_pixelmap_obj_t *self, size_t i, color_u rgbw) { - 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)) {