diff --git a/src/autotype/x11/AutoTypeX11.cpp b/src/autotype/x11/AutoTypeX11.cpp index 9d5f7be4..06e5b68d 100644 --- a/src/autotype/x11/AutoTypeX11.cpp +++ b/src/autotype/x11/AutoTypeX11.cpp @@ -547,10 +547,12 @@ int AutoTypePlatformX11::x11ErrorHandler(Display* display, XErrorEvent* error) XkbDescPtr AutoTypePlatformX11::getKeyboard() { - XDeviceInfo* devices; int num_devices; XID keyboard_id = XkbUseCoreKbd; - devices = XListInputDevices(m_dpy, &num_devices); + XDeviceInfo* devices = XListInputDevices(m_dpy, &num_devices); + if (!devices) { + return Q_NULLPTR; + } for (int i = 0; i < num_devices; i++) { if (QString(devices[i].name) == "Virtual core XTEST keyboard") {