aboutsummaryrefslogtreecommitdiffstats
path: root/src/keymap.c
diff options
context:
space:
mode:
authorEli Zaretskii2015-06-08 17:39:35 +0300
committerEli Zaretskii2015-06-08 17:39:35 +0300
commit296dadb14e19926de1fc5e0015cb8d4f10f9547a (patch)
tree127d453db3432952faa2472b5c434a2e61771e99 /src/keymap.c
parenta04d35cb02528c5584f01c1e3a2bbd86c943b221 (diff)
downloademacs-296dadb14e19926de1fc5e0015cb8d4f10f9547a.tar.gz
emacs-296dadb14e19926de1fc5e0015cb8d4f10f9547a.zip
Avoid crashes when key-binding is called from a timer
* src/keymap.c (Fkey_binding): Don't segfault if called with an empty vector as KEY. (Bug#20705)
Diffstat (limited to 'src/keymap.c')
-rw-r--r--src/keymap.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/keymap.c b/src/keymap.c
index 8f4ac0dd437..b69b409fc2d 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1652,10 +1652,14 @@ specified buffer position instead of point are used.
1652 1652
1653 if (NILP (position) && VECTORP (key)) 1653 if (NILP (position) && VECTORP (key))
1654 { 1654 {
1655 Lisp_Object event 1655 Lisp_Object event;
1656 /* mouse events may have a symbolic prefix indicating the 1656
1657 scrollbar or mode line */ 1657 if (ASIZE (key) == 0)
1658 = AREF (key, SYMBOLP (AREF (key, 0)) && ASIZE (key) > 1 ? 1 : 0); 1658 return Qnil;
1659
1660 /* mouse events may have a symbolic prefix indicating the
1661 scrollbar or mode line */
1662 event = AREF (key, SYMBOLP (AREF (key, 0)) && ASIZE (key) > 1 ? 1 : 0);
1659 1663
1660 /* We are not interested in locations without event data */ 1664 /* We are not interested in locations without event data */
1661 1665