Check whether we have a proper device before trying to get the screen for
it.

Signed-off-by: Peter Hutterer <[email protected]>
---
 src/wcmCommon.c |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/wcmCommon.c b/src/wcmCommon.c
index 24c75b9..758af4c 100644
--- a/src/wcmCommon.c
+++ b/src/wcmCommon.c
@@ -1107,28 +1107,28 @@ static void commonDispatchDevice(WacomCommonPtr common, 
unsigned int channel,
 
        /* Find the device the current events are meant for */
        tool = findTool(common, ds);
+       /* if a device matched criteria, handle filtering per device
+        * settings, and send event to XInput */
+       if (!tool || !tool->current || !tool->current->device)
+       {
+               DBG(11, common, "no device matches with"
+                               " id=%d, serial=%u\n",
+                               ds->device_type, ds->serial_num);
+               return;
+       }
+
        pDev = tool->current->device;
        DBG(11, common, "tool id=%d for %s\n", ds->device_type, pDev->name);
 
        /* Tool on the tablet when driver starts. This sometime causes
         * access errors to the device */
-       if (pDev && !miPointerGetScreen(pDev->dev))
+       if (!miPointerGetScreen(pDev->dev))
        {
                xf86Msg(X_ERROR, "wcmEvent: Wacom driver can not get Current 
Screen ID\n");
                xf86Msg(X_ERROR, "Please remove Wacom tool from the tablet and 
bring it back again.\n");
                return;
        }
 
-       /* if a device matched criteria, handle filtering per device
-        * settings, and send event to XInput */
-       if (!pDev)
-       {
-               DBG(11, common, "no device matches with"
-                               " id=%d, serial=%u\n",
-                               ds->device_type, ds->serial_num);
-               return;
-       }
-
        filtered = pChannel->valid.state;
 
        /* Device transformations come first */
-- 
1.7.3.4


------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Linuxwacom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to