Check return value of XOpenDisplay().
Instead of calling XGetXCBConnection() blindly, check XOpenDisplay()'s
return value to avoid a possible segfault in the former. That happens if
$DISPLAY is set, but if that display isn't available.
Signed-off-by: Cyril Brulebois <kibi@debian.org>
diff --git a/compositor/compositor-x11.c b/compositor/compositor-x11.c
index ba593c1..acc08fa 100644
--- a/compositor/compositor-x11.c
+++ b/compositor/compositor-x11.c
@@ -553,6 +553,10 @@
memset(c, 0, sizeof *c);
c->dpy = XOpenDisplay(NULL);
+
+ if (c->dpy == NULL)
+ return NULL;
+
c->conn = XGetXCBConnection(c->dpy);
if (xcb_connection_has_error(c->conn))