diff --git a/Xi/queryst.c b/Xi/queryst.c index 7bd405cdac..85a83f3dec 100644 --- a/Xi/queryst.c +++ b/Xi/queryst.c @@ -76,6 +76,13 @@ ProcXQueryDeviceState(ClientPtr client) if (rc != Success && rc != BadAccess) return rc; + /* dixLookupDevice() leaves dev NULL on anything other than Success, + * including BadAccess. The code below intentionally continues on + * BadAccess to blank out the state, but it cannot do so without a valid + * device, so bail out rather than dereferencing NULL. */ + if (!dev) + return rc; + v = dev->valuator; if (v != NULL && v->motionHintWindow != NULL) MaybeStopDeviceHint(dev, client);