From 3fc36f427a6dfe5366fd1391fee1d037a1bd6cd7 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 27 May 2017 15:57:38 +0300 Subject: [PATCH] Avoid args-out-of-range errors on fringe clicks after "C-h k" * src/keyboard.c (echo_truncate): Don't call Ftruncate if the echo message is already shorter than NCHARS. (Bug#27040) --- src/keyboard.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/keyboard.c b/src/keyboard.c index c9fa2a9f5e1..55486c6d9ab 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -634,7 +634,8 @@ echo_length (void) static void echo_truncate (ptrdiff_t nchars) { - if (STRINGP (KVAR (current_kboard, echo_string))) + Lisp_Object es = KVAR (current_kboard, echo_string); + if (STRINGP (es) && SCHARS (es) > nchars) kset_echo_string (current_kboard, Fsubstring (KVAR (current_kboard, echo_string), make_number (0), make_number (nchars))); -- 2.39.2