aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-07-26 07:46:19 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-07-26 19:36:24 +0800
commitee8606d31f01eed4a3e8efb6d8279fb5b4d2845e (patch)
treee2a2d10d2fd210d4a66569dcb5cdd6f66aabba98
parentcbfae548e8944801e766f42d966b38491afa8587 (diff)
downloadrneovim-ee8606d31f01eed4a3e8efb6d8279fb5b4d2845e.tar.gz
rneovim-ee8606d31f01eed4a3e8efb6d8279fb5b4d2845e.tar.bz2
rneovim-ee8606d31f01eed4a3e8efb6d8279fb5b4d2845e.zip
vim-patch:8.1.1424: crash when popup menu is deleted while waiting for char
Problem: Crash when popup menu is deleted while waiting for char. Solution: Bail out when pum_array was cleared. https://github.com/vim/vim/commit/5c3fb04623d0260762f1c3c1ba250a407098ff2a
-rw-r--r--src/nvim/popupmnu.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/nvim/popupmnu.c b/src/nvim/popupmnu.c
index 5b1b80935e..fce67437c7 100644
--- a/src/nvim/popupmnu.c
+++ b/src/nvim/popupmnu.c
@@ -1054,7 +1054,10 @@ void pum_show_popupmenu(vimmenu_T *menu)
ui_flush();
int c = vgetc();
- if (c == ESC || c == Ctrl_C) {
+
+ // Bail out when typing Esc, CTRL-C or some callback closed the popup
+ // menu.
+ if (c == ESC || c == Ctrl_C || pum_array == NULL) {
break;
} else if (c == CAR || c == NL) {
// enter: select current item, if any, and close