From fc8cb7cd14c3184c76321237cc0d6c7d520b9268 Mon Sep 17 00:00:00 2001 From: Felix Geyer Date: Sat, 26 Sep 2015 12:26:24 +0200 Subject: [PATCH] Check if XListInputDevices returns an error. Refs #351 --- src/autotype/x11/AutoTypeX11.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/autotype/x11/AutoTypeX11.cpp b/src/autotype/x11/AutoTypeX11.cpp index 9d5f7be48..06e5b68dc 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") {