From 1bfbc327c249fb9cad463a3949489fa2a55f3416 Mon Sep 17 00:00:00 2001 From: Aaron Ash Date: Fri, 14 Apr 2017 12:14:08 +1000 Subject: [PATCH] Handle null X events without error --- source/rofi.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/source/rofi.c b/source/rofi.c index 6f262697..f0c1dde2 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -662,9 +662,14 @@ static gboolean main_loop_x11_event_handler ( xcb_generic_event_t *ev, G_GNUC_UN { if ( ev == NULL ) { int status = xcb_connection_has_error ( xcb->connection ); - fprintf ( stderr, "The XCB connection to X server had a fatal error: %d\n", status ); - g_main_loop_quit ( main_loop ); - return G_SOURCE_REMOVE; + if(status > 0) { + fprintf ( stderr, "The XCB connection to X server had a fatal error: %d\n", status ); + g_main_loop_quit ( main_loop ); + return G_SOURCE_REMOVE; + } else { + fprintf ( stderr, "Warning: main_loop_x11_event_handler: ev == NULL, status == %d\n", status ); + return G_SOURCE_CONTINUE; + } } uint8_t type = ev->response_type & ~0x80; if ( type == xkb.first_event ) {