aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/dix
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/programs/Xserver/dix')
-rw-r--r--nx-X11/programs/Xserver/dix/devices.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/nx-X11/programs/Xserver/dix/devices.c b/nx-X11/programs/Xserver/dix/devices.c
index d31ff8224..51cf3fef9 100644
--- a/nx-X11/programs/Xserver/dix/devices.c
+++ b/nx-X11/programs/Xserver/dix/devices.c
@@ -1156,17 +1156,20 @@ ProcGetKeyboardMapping(ClientPtr client)
int
ProcGetPointerMapping(ClientPtr client)
{
+ int nElts;
xGetPointerMappingReply rep = {0};
ButtonClassPtr butc = inputInfo.pointer->button;
+ nElts = (butc) ? butc->numButtons : 0;
REQUEST_SIZE_MATCH(xReq);
rep.type = X_Reply;
+ rep.nElts = nElts;
rep.sequenceNumber = client->sequence;
- rep.nElts = butc->numButtons;
- rep.length = ((unsigned)rep.nElts + (4-1))/4;
+ rep.length = ((unsigned)nElts + (4-1))/4;
WriteReplyToClient(client, sizeof(xGetPointerMappingReply), &rep);
- WriteToClient(client, (int)rep.nElts, &butc->map[1]);
+ if (butc)
+ WriteToClient(client, nElts, &butc->map[1]);
return Success;
}