comparison src/popupmnu.c @ 15375:6012cc6936f7 v8.1.0695

patch 8.1.0695: internal error when using :popup commit https://github.com/vim/vim/commit/f42b45d719e03218735b3c2845a74dca9c0efd60 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jan 6 13:11:05 2019 +0100 patch 8.1.0695: internal error when using :popup Problem: Internal error when using :popup. Solution: When a menu only exists in Terminal mode give an error. (Naruhiko Nishino, closes #3765)
author Bram Moolenaar <Bram@vim.org>
date Sun, 06 Jan 2019 13:15:09 +0100
parents 605b9c42a8c5
children 55ccc2d353bd
comparison
equal deleted inserted replaced
15374:13a34f8e996b 15375:6012cc6936f7
1193 for (mp = menu->children; mp != NULL; mp = mp->next) 1193 for (mp = menu->children; mp != NULL; mp = mp->next)
1194 if (menu_is_separator(mp->dname) 1194 if (menu_is_separator(mp->dname)
1195 || (mp->modes & mp->enabled & mode)) 1195 || (mp->modes & mp->enabled & mode))
1196 ++pum_size; 1196 ++pum_size;
1197 1197
1198 // When there are only Terminal mode menus, using "popup Edit" results in
1199 // pum_size being zero.
1200 if (pum_size <= 0)
1201 {
1202 EMSG(e_menuothermode);
1203 return;
1204 }
1205
1198 array = (pumitem_T *)alloc_clear((unsigned)sizeof(pumitem_T) * pum_size); 1206 array = (pumitem_T *)alloc_clear((unsigned)sizeof(pumitem_T) * pum_size);
1199 if (array == NULL) 1207 if (array == NULL)
1200 return; 1208 return;
1201 1209
1202 for (mp = menu->children; mp != NULL; mp = mp->next) 1210 for (mp = menu->children; mp != NULL; mp = mp->next)