tablet: acknowledge that findTabletSeat might return nullptr

Never hit that case, but I figured it makes sense to account for the
case now since we have several paths that return nullptr.
This commit is contained in:
Aleix Pol 2020-07-26 18:03:08 +02:00 committed by Aleix Pol Gonzalez
parent 3a85b57ec2
commit 1ad88bdf7c

View file

@ -1575,6 +1575,10 @@ public:
{
if (device->isTabletTool()) {
KWaylandServer::TabletSeatInterface *tabletSeat = findTabletSeat();
if (!tabletSeat) {
qCCritical(KWIN_CORE) << "Could not find tablet manager";
return;
}
struct udev_device *const udev_device = libinput_device_get_udev_device(device->device());
const char *devnode = udev_device_get_devnode(udev_device);
tabletSeat->addTablet(device->vendor(), device->product(), device->sysName(), device->name(), {QString::fromUtf8(devnode)});
@ -1583,7 +1587,10 @@ public:
void removeDevice(const QString &sysname)
{
KWaylandServer::TabletSeatInterface *tabletSeat = findTabletSeat();
tabletSeat->removeTablet(sysname);
if (tabletSeat)
tabletSeat->removeTablet(sysname);
else
qCCritical(KWIN_CORE) << "Could not find tablet to remove" << sysname;
}
bool tabletToolEvent(TabletEvent *event) override
@ -1593,6 +1600,10 @@ public:
}
KWaylandServer::TabletSeatInterface *tabletSeat = findTabletSeat();
if (!tabletSeat) {
qCCritical(KWIN_CORE) << "Could not find tablet manager";
return false;
}
auto tool = tabletSeat->toolByHardwareSerial(event->serialId());
if (!tool) {
using namespace KWaylandServer;