From 69b14a6146f4fa2f0d1eb0910e321d0dfe3a177d Mon Sep 17 00:00:00 2001 From: fstengel Date: Mon, 4 May 2020 15:56:13 +0200 Subject: [PATCH] indev_button_proc: fix crash if points array not set (#1486) --- src/lv_core/lv_indev.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lv_core/lv_indev.c b/src/lv_core/lv_indev.c index cf5b909ba..38808d3ea 100644 --- a/src/lv_core/lv_indev.c +++ b/src/lv_core/lv_indev.c @@ -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) { + /* 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.y = i->btn_points[data->btn_id].y;