keyboard_indicators: fix segfault when -s is specified
Ali H. Fardan raiz@firemail.cc
Sat, 12 Aug 2017 07:01:13 +0300
1 files changed,
6 insertions(+),
0 deletions(-)
jump to
M
slstatus.c
→
slstatus.c
@@ -380,9 +380,15 @@
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: