From ce69f4c662c5749ac3ecade83e882c01b33f3610 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BA=A2=E6=A1=83=E5=85=AD?= <49054754+HongChao6@users.noreply.github.com> Date: Wed, 23 Apr 2025 18:36:15 +0800 Subject: [PATCH] fix(indev): fix indev gesture occasional crash (#8146) Signed-off-by: liuhongchao --- src/indev/lv_indev_gesture.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/indev/lv_indev_gesture.c b/src/indev/lv_indev_gesture.c index f6ec8e036a..928016bb29 100644 --- a/src/indev/lv_indev_gesture.c +++ b/src/indev/lv_indev_gesture.c @@ -778,6 +778,12 @@ static void process_touch_event(lv_indev_touch_data_t * touch, lv_indev_gesture_ /* Mark last item as un-used */ motion = get_motion(touch->id, g); + + if(motion == NULL) { + LV_LOG_ERROR("Released touch not found (id=%d)", touch->id); + return; + } + motion->finger = -1; motion->state = touch->state; } @@ -808,6 +814,12 @@ static void process_touch_event(lv_indev_touch_data_t * touch, lv_indev_gesture_ } else if(motion_idx >= 0) { motion = get_motion(touch->id, g); + + if(motion == NULL) { + LV_LOG_ERROR("Active touch missing (id=%d state=%d)", touch->id, touch->state); + return; + } + motion->point.x = touch->point.x; motion->point.y = touch->point.y; motion->state = touch->state;