Merge pull request #1755 from tannewt/fix_tilegrid_bounds_check

Always check TileGrid's x, y
This commit is contained in:
Dan Halbert 2019-04-05 17:51:04 -04:00 committed by GitHub
commit 8b9e93329d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -259,9 +259,10 @@ STATIC mp_obj_t tilegrid_subscr(mp_obj_t self_in, mp_obj_t index_obj, mp_obj_t v
mp_obj_get_array_fixed_n(index_obj, 2, &items);
x = mp_obj_get_int(items[0]);
y = mp_obj_get_int(items[1]);
if (x >= common_hal_displayio_tilegrid_get_width(self) || y >= common_hal_displayio_tilegrid_get_height(self)) {
mp_raise_IndexError(translate("tile index out of bounds"));
}
}
if (x >= common_hal_displayio_tilegrid_get_width(self) ||
y >= common_hal_displayio_tilegrid_get_height(self)) {
mp_raise_IndexError(translate("tile index out of bounds"));
}
if (value_obj == MP_OBJ_SENTINEL) {