From 0c7a2ee97ee862fd9d50b0aabab3cf97425d7daf Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Sat, 28 Dec 2013 15:28:53 -0800 Subject: proper error message on missing X display assert is inappropriate here because it is optimized out when compiling with NDEBUG --- src/xlib.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/xlib.c b/src/xlib.c index 2912321..ebc3a4c 100644 --- a/src/xlib.c +++ b/src/xlib.c @@ -172,8 +172,11 @@ static int xquit(Display *d){ } void backend_init(){ - display = XOpenDisplay (NULL); - assert(display); + display = XOpenDisplay(NULL); + if(!display){ + fprintf(stderr, "Can't open X display.\n"); + exit(EXIT_FAILURE); + } xfd = ConnectionNumber(display); screen = DefaultScreen(display); -- cgit v1.2.3