Browse Source
keyboard_indicators: fix segfault when -s is specified
master
Ali H. Fardan
8 years ago
committed by
Aaron Marcher
No known key found for this signature in database
GPG Key ID: 74B048E5C2474F9A
1 changed files with
6 additions and
0 deletions
-
slstatus.c
|
|
@ -380,9 +380,15 @@ kernel_release(void) |
|
|
static const char * |
|
|
static const char * |
|
|
keyboard_indicators(void) |
|
|
keyboard_indicators(void) |
|
|
{ |
|
|
{ |
|
|
|
|
|
Display *dpy = XOpenDisplay(NULL); |
|
|
XKeyboardState state; |
|
|
XKeyboardState state; |
|
|
|
|
|
|
|
|
|
|
|
if (dpy == NULL) { |
|
|
|
|
|
warnx("XOpenDisplay failed"); |
|
|
|
|
|
return UNKNOWN_STR; |
|
|
|
|
|
} |
|
|
XGetKeyboardControl(dpy, &state); |
|
|
XGetKeyboardControl(dpy, &state); |
|
|
|
|
|
XCloseDisplay(dpy); |
|
|
|
|
|
|
|
|
switch (state.led_mask) { |
|
|
switch (state.led_mask) { |
|
|
case 1: |
|
|
case 1: |
|
|
|