aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2021-10-28 20:52:41 +0300
committerEli Zaretskii2021-10-28 20:52:41 +0300
commitbea843dee19f2ac69f0d7a753d3bd917760a0344 (patch)
treeddf051e7a30ccc74fdf66ec33d40d7fd2ed336cd /src
parentf52fa1c1503e86c9388f0f6ceb1ef6780ee7f30b (diff)
downloademacs-bea843dee19f2ac69f0d7a753d3bd917760a0344.tar.gz
emacs-bea843dee19f2ac69f0d7a753d3bd917760a0344.zip
Avoid assertion violations in 'lookup-key'
* src/keymap.c (Flookup_key): Don't call ASIZE unless KEY is a vector. This avoids assertion violations when KEY is a string.
Diffstat (limited to 'src')
-rw-r--r--src/keymap.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/keymap.c b/src/keymap.c
index f7529f808bf..50f896d17cf 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1253,8 +1253,8 @@ recognize the default bindings, just as `read-key-sequence' does. */)
1253 /* Menu definitions might use mixed case symbols (notably in old 1253 /* Menu definitions might use mixed case symbols (notably in old
1254 versions of `easy-menu-define'). We accept this variation for 1254 versions of `easy-menu-define'). We accept this variation for
1255 backwards-compatibility. (Bug#50752) */ 1255 backwards-compatibility. (Bug#50752) */
1256 ptrdiff_t key_len = ASIZE (key); 1256 ptrdiff_t key_len = VECTORP (key) ? ASIZE (key) : 0;
1257 if (VECTORP (key) && key_len > 0 && EQ (AREF (key, 0), Qmenu_bar)) 1257 if (key_len > 0 && EQ (AREF (key, 0), Qmenu_bar))
1258 { 1258 {
1259 Lisp_Object new_key = make_vector (key_len, Qnil); 1259 Lisp_Object new_key = make_vector (key_len, Qnil);
1260 for (int i = 0; i < key_len; ++i) 1260 for (int i = 0; i < key_len; ++i)