chiark / gitweb /
input_id: Fix endless loop for non-input devices
[elogind.git] / extras / input_id / input_id.c
index 3754cdefee2faf6bbeaae2597c2d1b834fa6c0e8..fededa3f7d0ab1f83141d0d9ec4b29315492918a 100644 (file)
@@ -143,7 +143,7 @@ int main (int argc, char** argv)
 
        /* walk up the parental chain until we find the real input device; the
         * argument is very likely a subdevice of this, like eventN */
 
        /* walk up the parental chain until we find the real input device; the
         * argument is very likely a subdevice of this, like eventN */
-       while (udev_device_get_sysattr_value(dev, "capabilities/key") == NULL)
+       while (dev != NULL && udev_device_get_sysattr_value(dev, "capabilities/key") == NULL)
                dev = udev_device_get_parent(dev);
 
        /* Use this as a flag that input devices were detected, so that this
                dev = udev_device_get_parent(dev);
 
        /* Use this as a flag that input devices were detected, so that this