indev_button_proc: fix crash if points array not set (#1486)

This commit is contained in:
fstengel
2020-05-04 15:56:13 +02:00
committed by GitHub
parent 929bbcaee4
commit 69b14a6146

View File

@@ -660,6 +660,12 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
*/ */
static void indev_button_proc(lv_indev_t * i, lv_indev_data_t * data) static void indev_button_proc(lv_indev_t * i, lv_indev_data_t * data)
{ {
/* Die gracefully if i->btn_points is NULL */
if (i->btn_points == NULL) {
LV_LOG_WARN("indev_button_proc: btn_points was NULL");
return;
}
i->proc.types.pointer.act_point.x = i->btn_points[data->btn_id].x; i->proc.types.pointer.act_point.x = i->btn_points[data->btn_id].x;
i->proc.types.pointer.act_point.y = i->btn_points[data->btn_id].y; i->proc.types.pointer.act_point.y = i->btn_points[data->btn_id].y;