From 91e4f527da0e69237e2bf09b4db60de64f7bd01a Mon Sep 17 00:00:00 2001 From: tweqx <29614762+tweqx@users.noreply.github.com> Date: Fri, 13 Feb 2026 16:20:11 +0000 Subject: [PATCH] Fix crash when termcap is used and cursor_left is unavailable --- src/editline.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/editline.c b/src/editline.c index f19d328..52e8115 100644 --- a/src/editline.c +++ b/src/editline.c @@ -1342,9 +1342,10 @@ void rl_reset_terminal(const char *terminal_name) #ifdef CONFIG_USE_TERMCAP bp = buf; - if (-1 != tgetent(buf, el_term)) { - if ((backspace = tgetstr("le", &bp)) != NULL) - backspace = strdup(backspace); + if (1 == tgetent(buf, el_term)) { + char *maybe_backspace = tgetstr("le", &bp); + if (maybe_backspace != NULL) + backspace = strdup(maybe_backspace); tty_cols = tgetnum("co"); tty_rows = tgetnum("li"); }