diff options
author | Ali H. Fardan <raiz@firemail.cc> | 2017-08-12 07:01:13 +0300 |
---|---|---|
committer | Aaron Marcher <me@drkhsh.at> | 2017-08-12 12:50:11 +0200 |
commit | 2c114ec2b506e32d54586110c710c78ef156e066 (patch) | |
tree | 1ff2da2b481709e6132864a826b5d6298f25dbf5 /slstatus.c | |
parent | 6f011743921db04e5513df45c5ac4b2c752d52de (diff) |
keyboard_indicators: fix segfault when -s is specified
Diffstat (limited to 'slstatus.c')
-rw-r--r-- | slstatus.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -380,9 +380,15 @@ kernel_release(void) static const char * keyboard_indicators(void) { + Display *dpy = XOpenDisplay(NULL); XKeyboardState state; + if (dpy == NULL) { + warnx("XOpenDisplay failed"); + return UNKNOWN_STR; + } XGetKeyboardControl(dpy, &state); + XCloseDisplay(dpy); switch (state.led_mask) { case 1: |