Skip to content
Snippets Groups Projects
Verified Commit 546a203c authored by rahix's avatar rahix
Browse files

fix(pycardium): Fix not properly checking type of color


Signed-off-by: default avatarRahix <rahix@rahix.de>
parent a9f770a6
No related branches found
No related tags found
No related merge requests found
Pipeline #711 passed
......@@ -6,10 +6,13 @@
static mp_obj_t mp_leds_set(mp_obj_t led_in, mp_obj_t color_in)
{
mp_check_self(mp_obj_is_type(color_in, &mp_type_list));
mp_obj_list_t*color = MP_OBJ_TO_PTR(color_in);
int led = mp_obj_get_int(led_in);
if (!mp_obj_is_type(color_in, &mp_type_list)) {
mp_raise_TypeError("color must be a list");
}
mp_obj_list_t*color = MP_OBJ_TO_PTR(color_in);
if (color->len < 3) {
mp_raise_ValueError("color list must have 3 elements");
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment