btnm: fix undeflow in buttons arrea calculation

This commit is contained in:
Gabor Kiss-Vamosi
2020-03-20 11:05:42 +01:00
parent 786e151661
commit 34aaf71a17

View File

@@ -233,7 +233,7 @@ void lv_btnmatrix_set_map(lv_obj_t * btnm, const char * map[])
/* Set the button's area. /* Set the button's area.
* If inner padding is zero then use the prev. button x2 as x1 to avoid rounding * If inner padding is zero then use the prev. button x2 as x1 to avoid rounding
* errors*/ * errors*/
if(inner == 0 && ((act_x == left && base_dir != LV_BIDI_DIR_RTL) || (act_x + act_unit_w == max_w - right && base_dir == LV_BIDI_DIR_RTL))) { if(btn_i != 0 && inner == 0 && ((act_x == left && base_dir != LV_BIDI_DIR_RTL) || (act_x + act_unit_w == max_w - right && base_dir == LV_BIDI_DIR_RTL))) {
lv_area_set(&ext->button_areas[btn_i], ext->button_areas[btn_i - 1].x2, act_y, act_x + act_unit_w, lv_area_set(&ext->button_areas[btn_i], ext->button_areas[btn_i - 1].x2, act_y, act_x + act_unit_w,
act_y + btn_h); act_y + btn_h);
} }