From a4f17312ee17683c6768f21a53a8474a0c426216 Mon Sep 17 00:00:00 2001 From: Guillaume Chereau Date: Mon, 1 Jul 2024 22:43:26 +0800 Subject: [PATCH] Fix compilation error --- src/gesture3d.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gesture3d.c b/src/gesture3d.c index 17974cddf..acc7bd66b 100644 --- a/src/gesture3d.c +++ b/src/gesture3d.c @@ -126,10 +126,10 @@ static int update_state(gesture3d_t *gest) int gesture3d(const gesture3d_t *gest, int *nb, gesture3d_t gestures[]) { int i; - gesture3d_t *other, *match; + gesture3d_t *other, *match = NULL; // Search if we already have this gesture in the list. - for (i = 0; i < goxel.gesture3ds_count; i++) { + for (i = 0; i < *nb; i++) { match = &gestures[i]; if ( match->callback == gest->callback && match->type == gest->type) { @@ -141,6 +141,7 @@ int gesture3d(const gesture3d_t *gest, int *nb, gesture3d_t gestures[]) match = &gestures[(*nb)++]; memset(match, 0, sizeof(*match)); } + assert(match); // Search if we already have a different active gesture. // XXX: should depend on the type.