linux: Fix critical when searching for sibling devices

GUdev-CRITICAL **: g_udev_device_get_sysfs_path: assertion 'G_UDEV_IS_DEVICE (device)' failed

This is caused by looking for devices in a particular subsystem which
don't have parents. This can happen with virtual devices, such as the
ones created by test suites.
This commit is contained in:
Bastien Nocera 2017-03-24 17:14:06 +01:00
parent a2eecff867
commit 86e5237807

View file

@ -932,6 +932,8 @@ up_device_supply_get_sibling_with_subsystem (GUdevDevice *device,
const char *p_path;
p = g_udev_device_get_parent (d);
if (!p)
continue;
p_path = g_udev_device_get_sysfs_path (p);
if (g_strcmp0 (p_path, parent_path) == 0)
sibling = g_object_ref (d);