validate palette color count and group scale
This commit is contained in:
parent
67fd815e27
commit
5f3f87e371
|
@ -56,7 +56,7 @@ STATIC mp_obj_t displayio_group_make_new(const mp_obj_type_t *type, size_t n_arg
|
|||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
mp_int_t scale = mp_arg_validate_int_min(args[ARG_scale].u_int, 1, MP_QSTR_scale);
|
||||
mp_int_t scale = mp_arg_validate_int_range(args[ARG_scale].u_int, 1, 32767,MP_QSTR_scale);
|
||||
|
||||
displayio_group_t *self = m_new_obj(displayio_group_t);
|
||||
self->base.type = &displayio_group_type;
|
||||
|
|
|
@ -58,7 +58,7 @@ STATIC mp_obj_t displayio_palette_make_new(const mp_obj_type_t *type, size_t n_a
|
|||
|
||||
displayio_palette_t *self = m_new_obj(displayio_palette_t);
|
||||
self->base.type = &displayio_palette_type;
|
||||
common_hal_displayio_palette_construct(self, args[ARG_color_count].u_int);
|
||||
common_hal_displayio_palette_construct(self, mp_arg_validate_int_range(args[ARG_color_count].u_int, 1, 32767, MP_QSTR_color_count));
|
||||
|
||||
return MP_OBJ_FROM_PTR(self);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue