summaryrefslogtreecommitdiffstats
path: root/src/glx/dri2.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/glx/dri2.c')
-rw-r--r--src/glx/dri2.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/glx/dri2.c b/src/glx/dri2.c
index 7cb9d2dba9c..cc6c1641669 100644
--- a/src/glx/dri2.c
+++ b/src/glx/dri2.c
@@ -131,10 +131,14 @@ DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire)
aevent->msc = ((CARD64)awire->msc_hi << 32) | awire->msc_lo;
glxDraw = GetGLXDrawable(dpy, pdraw->drawable);
- if (awire->sbc < glxDraw->lastEventSbc)
- glxDraw->eventSbcWrap += 0x100000000;
- glxDraw->lastEventSbc = awire->sbc;
- aevent->sbc = awire->sbc + glxDraw->eventSbcWrap;
+ if (glxDraw != NULL) {
+ if (awire->sbc < glxDraw->lastEventSbc)
+ glxDraw->eventSbcWrap += 0x100000000;
+ glxDraw->lastEventSbc = awire->sbc;
+ aevent->sbc = awire->sbc + glxDraw->eventSbcWrap;
+ } else {
+ aevent->sbc = awire->sbc;
+ }
return True;
}