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
This commit is contained in:
Peter Hutterer
2023-07-03 13:30:24 +10:00
parent 94a52a8488
commit 310db4206f

View File

@@ -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();