dix: protect against missing ButtonClasses in GetPointerMapping.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2009-06-07 19:26:45 +10:00
parent 21ee53060b
commit 9390b7a133

View File

@ -1724,10 +1724,11 @@ ProcGetPointerMapping(ClientPtr client)
rep.type = X_Reply; rep.type = X_Reply;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
rep.nElts = butc->numButtons; rep.nElts = (butc) ? butc->numButtons : 0;
rep.length = ((unsigned)rep.nElts + (4-1))/4; rep.length = ((unsigned)rep.nElts + (4-1))/4;
WriteReplyToClient(client, sizeof(xGetPointerMappingReply), &rep); WriteReplyToClient(client, sizeof(xGetPointerMappingReply), &rep);
(void)WriteToClient(client, (int)rep.nElts, (char *)&butc->map[1]); if (butc)
WriteToClient(client, (int)rep.nElts, (char *)&butc->map[1]);
return Success; return Success;
} }