tui_tk_ti_getstr: handle weird value #9688

tigetstr (used by libtermkey/driver-ti.c) may return -1 as a pointer.
Documented in man 3 tigetstr. https://linux.die.net/man/3/tigetstr

> The tigetstr routine returns the value (char *)-1 if capname is not a string
> capability, or 0 if it is canceled or absent from the terminal description.

Fixed #9687
This commit is contained in:
Boskovits 2019-03-07 11:42:58 +01:00 committed by Justin M. Keyes
parent 980dd7c011
commit b51e5d8b8d

View File

@ -2000,7 +2000,7 @@ static const char *tui_tk_ti_getstr(const char *name, const char *value,
} else if (strequal(name, "key_dc")) {
DLOG("libtermkey:kdch1=%s", value);
// Vim: "If <BS> and <DEL> are now the same, redefine <DEL>."
if (value != NULL && strequal(stty_erase, value)) {
if (value != NULL && value != (char *)-1 && strequal(stty_erase, value)) {
return stty_erase[0] == DEL ? CTRL_H_STR : DEL_STR;
}
} else if (strequal(name, "key_mouse")) {