From: Michael Stapelberg Date: Wed, 27 Jul 2011 11:30:12 +0000 (+0200) Subject: i3-nagbar: correctly check for errors when connecting to X11 X-Git-Tag: 4.0~14^2~42 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=0d77ca9a3dcc4f2273b7c05be8e3fd6768e4700d;p=i3%2Fi3 i3-nagbar: correctly check for errors when connecting to X11 --- diff --git a/i3-nagbar/main.c b/i3-nagbar/main.c index aba5ea14..d0d7e77a 100644 --- a/i3-nagbar/main.c +++ b/i3-nagbar/main.c @@ -260,8 +260,9 @@ int main(int argc, char *argv[]) { } int screens; - xcb_connection_t *conn = xcb_connect(NULL, &screens); - if (xcb_connection_has_error(conn)) + xcb_connection_t *conn; + if ((conn = xcb_connect(NULL, &screens)) == NULL || + xcb_connection_has_error(conn)) die("Cannot open display\n"); /* Place requests for the atoms we need as soon as possible */