aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Hawthorn <john.hawthorn@gmail.com>2013-12-28 15:28:53 -0800
committerJohn Hawthorn <john.hawthorn@gmail.com>2013-12-28 15:29:09 -0800
commit0c7a2ee97ee862fd9d50b0aabab3cf97425d7daf (patch)
treed96e12f0e96594f5404b16dbcbf119e56dbc0e61
parent6040b2ef005a427190a6173427a08b38e41697b6 (diff)
downloadmirror-meh-0c7a2ee97ee862fd9d50b0aabab3cf97425d7daf.tar.gz
mirror-meh-0c7a2ee97ee862fd9d50b0aabab3cf97425d7daf.tar.bz2
mirror-meh-0c7a2ee97ee862fd9d50b0aabab3cf97425d7daf.zip
proper error message on missing X display
assert is inappropriate here because it is optimized out when compiling with NDEBUG
-rw-r--r--src/xlib.c7
1 files 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);