Skip to content

Commit e2dabae

Browse files
Kennytannewt
andauthored
vectorio: Drop a duplication in Polygon.c
Co-authored-by: Scott Shawcroft <[email protected]>
1 parent 79c1972 commit e2dabae

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

shared-module/vectorio/Polygon.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,8 @@ static void _clobber_points_list(vectorio_polygon_t *self, mp_obj_t points_tuple
4242
if (tuple_len != 2) {
4343
mp_raise_ValueError_varg(translate("%q must be a tuple of length 2"), MP_QSTR_point);
4444
}
45-
if (!mp_obj_get_int_maybe(tuple_items[0], &self->points_list[2*i])) {
46-
self->len = 0;
47-
gc_free( self->points_list );
48-
self->points_list = NULL;
49-
mp_raise_ValueError_varg(translate("unsupported %q type"), MP_QSTR_point);
50-
}
51-
if (!mp_obj_get_int_maybe(tuple_items[1], &self->points_list[2*i + 1])) {
45+
if (!mp_obj_get_int_maybe(tuple_items[0], &self->points_list[2*i]) ||
46+
!mp_obj_get_int_maybe(tuple_items[1], &self->points_list[2*i + 1])) {
5247
self->len = 0;
5348
gc_free( self->points_list );
5449
self->points_list = NULL;
@@ -148,4 +143,3 @@ uint32_t common_hal_vectorio_polygon_get_pixel(void *obj, int16_t x, int16_t y)
148143
}
149144
return winding_number == 0 ? 0 : 1;
150145
}
151-

0 commit comments

Comments
 (0)