summaryrefslogtreecommitdiff
path: root/src/popupmnu.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-01-06 13:11:05 +0100
committerBram Moolenaar <Bram@vim.org>2019-01-06 13:11:05 +0100
commitf42b45d719e03218735b3c2845a74dca9c0efd60 (patch)
treee5974454b590f16abc0aeafa523f4a710bdbf24e /src/popupmnu.c
parent4614f53e0f853b513963d1a639398348a571ecf1 (diff)
downloadvim-git-f42b45d719e03218735b3c2845a74dca9c0efd60.tar.gz
patch 8.1.0695: internal error when using :popupv8.1.0695
Problem: Internal error when using :popup. Solution: When a menu only exists in Terminal mode give an error. (Naruhiko Nishino, closes #3765)
Diffstat (limited to 'src/popupmnu.c')
-rw-r--r--src/popupmnu.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/popupmnu.c b/src/popupmnu.c
index 6ef0af92a..962a59a1b 100644
--- a/src/popupmnu.c
+++ b/src/popupmnu.c
@@ -1195,6 +1195,14 @@ pum_show_popupmenu(vimmenu_T *menu)
|| (mp->modes & mp->enabled & mode))
++pum_size;
+ // When there are only Terminal mode menus, using "popup Edit" results in
+ // pum_size being zero.
+ if (pum_size <= 0)
+ {
+ EMSG(e_menuothermode);
+ return;
+ }
+
array = (pumitem_T *)alloc_clear((unsigned)sizeof(pumitem_T) * pum_size);
if (array == NULL)
return;