From 310db4206f2d2fc793e3044ee9886a20cc14ee86 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 3 Jul 2023 13:30:24 +1000 Subject: [PATCH] Don't run past the last element in the list If there is no (other) libinput device in the current device list, we'd eventually end up with next == NULL, causing a segfault. Fixes #60 --- src/xf86libinput.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xf86libinput.c b/src/xf86libinput.c index b811ce0..f7a7553 100644 --- a/src/xf86libinput.c +++ b/src/xf86libinput.c @@ -1500,7 +1500,7 @@ swap_registered_device(InputInfoPtr pInfo) return; next = xf86FirstLocalDevice(); - while (next == pInfo || !is_libinput_device(next)) + while (next && (next == pInfo || !is_libinput_device(next))) next = next->next; input_lock();