udev@drm: Acknowledge that udev_monitor_receive_device can return NULL
Do not build UDevDevice unless the device itself is valid.
This commit is contained in:
parent
97b9e516d1
commit
d216e74cfc
1 changed files with 6 additions and 1 deletions
|
@ -306,7 +306,12 @@ UdevDevice::Ptr UdevMonitor::getDevice()
|
|||
if (!m_monitor) {
|
||||
return UdevDevice::Ptr();
|
||||
}
|
||||
return UdevDevice::Ptr(new UdevDevice(udev_monitor_receive_device(m_monitor)));
|
||||
auto dev = udev_monitor_receive_device(m_monitor);
|
||||
if (!dev) {
|
||||
return {};
|
||||
}
|
||||
|
||||
return UdevDevice::Ptr(new UdevDevice(dev));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue