i3-nagbar: correctly check for errors when connecting to X11

This commit is contained in:
Michael Stapelberg 2011-07-27 13:30:12 +02:00
parent ec88f6501d
commit 0d77ca9a3d

View File

@ -260,8 +260,9 @@ int main(int argc, char *argv[]) {
} }
int screens; int screens;
xcb_connection_t *conn = xcb_connect(NULL, &screens); xcb_connection_t *conn;
if (xcb_connection_has_error(conn)) if ((conn = xcb_connect(NULL, &screens)) == NULL ||
xcb_connection_has_error(conn))
die("Cannot open display\n"); die("Cannot open display\n");
/* Place requests for the atoms we need as soon as possible */ /* Place requests for the atoms we need as soon as possible */