Commit 1ad88bdf authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧 Committed by Aleix Pol Gonzalez
Browse files

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.
parent 3a85b57e
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment