From 7a0ed875f709d0f32b7a1b3f61bcefdc0da9e403 Mon Sep 17 00:00:00 2001 From: sabetts Date: Tue, 15 Jan 2002 18:50:42 +0000 Subject: fixed crash on solaris --- ChangeLog | 5 +++++ src/input.c | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 5ae55d0..995697b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2002-01-15 Shawn Betts + + * src/input.c (keysym_to_string): handle the case when + XKeysymToString returns NULL. + 2002-01-11 shawn * src/main.c (handler): store the error text at the beginning of diff --git a/src/input.c b/src/input.c index bd264c1..b0ae865 100644 --- a/src/input.c +++ b/src/input.c @@ -199,6 +199,7 @@ grab_key (int keycode, unsigned int modifiers, Window grab_window) char * keysym_to_string (KeySym keysym, unsigned int modifier) { + static char *null_string = "NULL"; /* A NULL string. */ struct sbuf *name; char *tmp; @@ -210,7 +211,13 @@ keysym_to_string (KeySym keysym, unsigned int modifier) if (modifier & RP_HYPER_MASK) sbuf_concat (name, "H-"); if (modifier & RP_SUPER_MASK) sbuf_concat (name, "S-"); - sbuf_concat (name, XKeysymToString (keysym)); + /* On solaris machines (perhaps other machines as well) this call + can return NULL. In this case use the "NULL" string. */ + tmp = XKeysymToString (keysym); + if (tmp == NULL) + tmp = null_string; + + sbuf_concat (name, tmp); /* Eat the nut and throw away the shells. */ tmp = sbuf_get (name); -- cgit v1.2.3