While the NONE Atom indicates that the driver should reset the
action at the index it resides it, it is not *itself* a valid
action. This patch prevents us from attempting to set NONE as
an action.

Signed-off-by: Jason Gerecke <killert...@gmail.com>
---
 src/wcmXCommand.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c
index a1e23e1..a5b41d2 100644
--- a/src/wcmXCommand.c
+++ b/src/wcmXCommand.c
@@ -370,8 +370,13 @@ static int wcmCheckActionProperty(WacomDevicePtr priv, 
Atom property, XIProperty
        int j;
 
        if (!property) {
-               DBG(5, priv, "WARNING: property == 0\n");
-               return Success;
+               DBG(3, priv, "ERROR: Atom is NONE\n");
+               return BadMatch;
+       }
+
+       if (prop == NULL) {
+               DBG(3, priv, "ERROR: Value is NULL\n");
+               return BadMatch;
        }
 
        if (prop->size >= 255) {
@@ -456,7 +461,7 @@ static int wcmSetActionProperty(DeviceIntPtr dev, Atom 
property,
                return rc;
        }
 
-       if (!checkonly && prop)
+       if (!checkonly)
        {
                memset(action, 0, sizeof(*action));
                for (i = 0; i < prop->size; i++)
@@ -550,11 +555,13 @@ static int wcmSetActionsProperty(DeviceIntPtr dev, Atom 
property,
                        if (subproperty != handlers[index])
                                subproperty = handlers[index];
                }
-
-               XIGetDeviceProperty(dev, subproperty, &subprop);
-               rc = wcmSetActionProperty(dev, subproperty, subprop, checkonly, 
&handlers[index], &actions[index]);
-               if (rc != Success)
-                       return rc;
+               else
+               {
+                       XIGetDeviceProperty(dev, subproperty, &subprop);
+                       rc = wcmSetActionProperty(dev, subproperty, subprop, 
checkonly, &handlers[index], &actions[index]);
+                       if (rc != Success)
+                               return rc;
+               }
        }
 
        return Success;
-- 
1.8.1.1


------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to